31 lines
1.2 KiB
Python
Executable File
31 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
# under the terms of either the GNU Lesser General Public License Version 3
|
|
# or the Perl Artistic License Version 2.0.
|
|
# SPDX-FileCopyrightText: 2026 Wilson Snyder
|
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
|
|
|
import vltest_bootstrap
|
|
|
|
test.scenarios('dist')
|
|
|
|
# Real-world repro: a misconfigured VERILATOR_BIN that points back at the
|
|
# Perl wrapper used to fork-bomb the host. The wrapper now caps re-entry
|
|
# depth via $VERILATOR_RUNNING and aborts past the cap.
|
|
os.environ['VERILATOR_BIN'] = os.environ["VERILATOR_ROOT"] + "/bin/verilator"
|
|
|
|
# --no-unlimited-stack avoids the ulimit_stack_unlimited() backtick branch,
|
|
# which would otherwise double the recursion fanout. Linear re-entry through
|
|
# run() is enough to exercise the depth-cap abort.
|
|
test.run(
|
|
fails=True,
|
|
cmd=[os.environ["VERILATOR_ROOT"] + "/bin/verilator", "--no-unlimited-stack", "--version"],
|
|
logfile=test.run_log_filename)
|
|
|
|
test.file_grep(test.run_log_filename,
|
|
r'%Error: verilator: re-entered \d+ levels deep via \$VERILATOR_RUNNING')
|
|
|
|
test.passes()
|