From a2b6aca2889184a51448f74d972ea2973e722d25 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 14 Sep 2025 08:43:52 -0400 Subject: [PATCH] Tests: Refactor to create test.root variable. No test change. --- test_regress/driver.py | 1 + test_regress/t/t_a5_attributes_include.py | 12 +++++------ test_regress/t/t_a5_attributes_src.py | 17 ++++++++-------- test_regress/t/t_a6_examples.py | 6 ++---- test_regress/t/t_assert_comp_bad.py | 20 +++++++++---------- test_regress/t/t_dfg_break_cycles.py | 6 ++---- test_regress/t/t_dfg_peephole.py | 4 +--- test_regress/t/t_dfg_synthesis.py | 4 +--- test_regress/t/t_dfg_synthesis_pre_inline.py | 4 +--- test_regress/t/t_dist_attributes_bad.py | 8 +++----- test_regress/t/t_dist_cinclude.py | 8 +++----- test_regress/t/t_dist_contributors.py | 8 +++----- test_regress/t/t_dist_copyright.py | 8 +++----- test_regress/t/t_dist_cppstyle.py | 12 +++++------ test_regress/t/t_dist_docs_style.py | 12 +++++------ test_regress/t/t_dist_docs_summary.py | 16 +++++++-------- test_regress/t/t_dist_docs_warnings.py | 16 +++++++-------- test_regress/t/t_dist_error_format.py | 6 ++---- test_regress/t/t_dist_fixme.py | 8 +++----- test_regress/t/t_dist_getsetorder.py | 12 +++++------ test_regress/t/t_dist_header_cc.py | 6 ++---- test_regress/t/t_dist_install.py | 14 ++++++------- test_regress/t/t_dist_lint_py.py | 6 ++---- test_regress/t/t_dist_pl.py | 4 +--- test_regress/t/t_dist_portability.py | 12 +++++------ test_regress/t/t_dist_untracked.py | 6 ++---- test_regress/t/t_dist_warn_coverage.py | 12 +++++------ test_regress/t/t_dist_whitespace.py | 14 +++++-------- .../t/t_event_control_star_never_bad.py | 8 +++----- test_regress/t/t_lint_assigneqexpr_bad.py | 6 ++---- test_regress/t/t_lint_badvltpragma_bad.py | 8 +++----- test_regress/t/t_lint_didnotconverge_bad.py | 8 +++----- .../t/t_lint_didnotconverge_nodbg_bad.py | 6 ++---- test_regress/t/t_lint_multidriven_bad.py | 8 +++----- test_regress/t/t_lint_paramnodefault_bad.py | 8 +++----- test_regress/t/t_lint_pinmissing_bad.py | 8 +++----- test_regress/t/t_lint_procassinit_bad.py | 10 ++++------ test_regress/t/t_lint_stmtdly_bad.py | 8 +++----- test_regress/t/t_lint_widthexpand_docs_bad.py | 10 ++++------ test_regress/t/t_var_bad_hide_docs.py | 8 +++----- test_regress/t/t_verilated_all.py | 9 ++++----- test_regress/t/t_verilated_all_newest.py | 4 +--- test_regress/t/t_verilated_threaded.py | 4 +--- 43 files changed, 147 insertions(+), 228 deletions(-) diff --git a/test_regress/driver.py b/test_regress/driver.py index 97137696d..8e0cf3ee2 100755 --- a/test_regress/driver.py +++ b/test_regress/driver.py @@ -618,6 +618,7 @@ class VlTest: self.py_filename = py_filename # Name of .py file to get setup from self.running_id = running_id self.scenario = scenario + self.root = '..' # Relative path to git root (above test_regress) self._force_pass = False self._have_solver_called = False diff --git a/test_regress/t/t_a5_attributes_include.py b/test_regress/t/t_a5_attributes_include.py index 5959677ae..aa7fb958a 100755 --- a/test_regress/t/t_a5_attributes_include.py +++ b/test_regress/t/t_a5_attributes_include.py @@ -12,8 +12,6 @@ import vltest_bootstrap test.scenarios('dist') test.rerunnable = False -root = ".." - def have_clang_check(): cmd = 'python3 -c "from clang.cindex import Index; index = Index.create(); print(\\"Clang imported\\")";' @@ -27,21 +25,21 @@ def have_clang_check(): if 'VERILATOR_TEST_NO_ATTRIBUTES' in os.environ: test.skip("Skipping due to VERILATOR_TEST_NO_ATTRIBUTES") -if not os.path.exists(root + "/src/obj_dbg/compile_commands.json"): +if not os.path.exists(test.root + "/src/obj_dbg/compile_commands.json"): test.skip("compile_commands.json not found. Please install 'bear > 3.0' and rebuild Verilator") if not have_clang_check(): test.skip("No libclang installed") # some of the files are only used in Verilation # and are only in "include" folder -srcfiles = test.glob_some(root + "/include/*.cpp") +srcfiles = test.glob_some(test.root + "/include/*.cpp") srcfiles_str = " ".join(srcfiles) -clang_args = "-I" + root + "/include/ -I" + root + "/include/vltstd/ -fcoroutines-ts" +clang_args = "-I" + test.root + "/include/ -I" + test.root + "/include/vltstd/ -fcoroutines-ts" test.run(logfile=test.run_log_filename, tee=True, - cmd=["python3", root + "/nodist/clang_check_attributes", - "--verilator-root=" + root, + cmd=["python3", test.root + "/nodist/clang_check_attributes", + "--verilator-root=" + test.root, "--cxxflags='" + clang_args + "'", srcfiles_str]) # yapf:disable diff --git a/test_regress/t/t_a5_attributes_src.py b/test_regress/t/t_a5_attributes_src.py index 185d8eb46..28c719609 100755 --- a/test_regress/t/t_a5_attributes_src.py +++ b/test_regress/t/t_a5_attributes_src.py @@ -12,8 +12,6 @@ import vltest_bootstrap test.scenarios('dist') test.rerunnable = False -root = ".." - def have_clang_check(): cmd = 'python3 -c "from clang.cindex import Index; index = Index.create(); print(\\"Clang imported\\")";' @@ -27,24 +25,25 @@ def have_clang_check(): if 'VERILATOR_TEST_NO_ATTRIBUTES' in os.environ: test.skip("Skipping due to VERILATOR_TEST_NO_ATTRIBUTES") -if not os.path.exists(root + "/src/obj_dbg/compile_commands.json"): +if not os.path.exists(test.root + "/src/obj_dbg/compile_commands.json"): test.skip("compile_commands.json not found. Please install 'bear > 3.0' and rebuild Verilator") if not have_clang_check(): test.skip("No libclang installed") # some of the files are only used in Verilation # and are only in "include" folder -srcfiles = test.glob_some(root + "/src/*.cpp") + test.glob_some(root + - "/src/obj_dbg/V3Const__gen.cpp") +srcfiles = test.glob_some(test.root + + "/src/*.cpp") + test.glob_some(test.root + + "/src/obj_dbg/V3Const__gen.cpp") srcfiles = [f for f in srcfiles if re.search(r'\/(V3Const|Vlc\w*|\w*_test|\w*_sc|\w*.yy).cpp$', f)] srcfiles_str = " ".join(srcfiles) test.run(logfile=test.run_log_filename, tee=True, - cmd=["python3", root + "/nodist/clang_check_attributes", - "--verilator-root=" + root, - "--compilation-root=" + root + "/src/obj_dbg", - "--compile-commands-dir=" + root + "/src/obj_dbg", + cmd=["python3", test.root + "/nodist/clang_check_attributes", + "--verilator-root=" + test.root, + "--compilation-root=" + test.root + "/src/obj_dbg", + "--compile-commands-dir=" + test.root + "/src/obj_dbg", srcfiles_str]) # yapf:disable test.file_grep(test.run_log_filename, r'Number of functions reported unsafe: +(\d+)', 0) diff --git a/test_regress/t/t_a6_examples.py b/test_regress/t/t_a6_examples.py index 8d2bb7005..34ba28900 100755 --- a/test_regress/t/t_a6_examples.py +++ b/test_regress/t/t_a6_examples.py @@ -13,12 +13,10 @@ test.scenarios('dist') test.clean_command = '/bin/rm -rf ../examples/*/build ../examples/*/obj*' -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") -examples = sorted(test.glob_some(root + "/examples/*")) +examples = sorted(test.glob_some(test.root + "/examples/*")) for example in examples: test.run(cmd=[os.environ["MAKE"], "-C", example]) diff --git a/test_regress/t/t_assert_comp_bad.py b/test_regress/t/t_assert_comp_bad.py index 114fbe952..5a3852f87 100755 --- a/test_regress/t/t_assert_comp_bad.py +++ b/test_regress/t/t_assert_comp_bad.py @@ -11,9 +11,7 @@ import vltest_bootstrap test.scenarios('simulator') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.compile(verilator_flags2=['--assert'], @@ -23,35 +21,35 @@ test.compile(verilator_flags2=['--assert'], expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_USERWARN_faulty.rst", + out_filename=test.root + "/docs/gen/ex_USERWARN_faulty.rst", regexp=r'\$warn.*User') test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_USERERROR_faulty.rst", + out_filename=test.root + "/docs/gen/ex_USERERROR_faulty.rst", regexp=r'\$error.*User') test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_USERINFO_faulty.rst", + out_filename=test.root + "/docs/gen/ex_USERINFO_faulty.rst", regexp=r'\$info.*User') test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_USERFATAL_faulty.rst", + out_filename=test.root + "/docs/gen/ex_USERFATAL_faulty.rst", regexp=r'\$fatal.*User') test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_USERWARN_msg.rst", + out_filename=test.root + "/docs/gen/ex_USERWARN_msg.rst", regexp=r'USERWARN:.* User') test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_USERERROR_msg.rst", + out_filename=test.root + "/docs/gen/ex_USERERROR_msg.rst", regexp=r'USERERROR:.* User') test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_USERINFO_msg.rst", + out_filename=test.root + "/docs/gen/ex_USERINFO_msg.rst", regexp=r'-Info:.* User') test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_USERFATAL_msg.rst", + out_filename=test.root + "/docs/gen/ex_USERFATAL_msg.rst", regexp=r'USERFATAL:.* User') test.passes() diff --git a/test_regress/t/t_dfg_break_cycles.py b/test_regress/t/t_dfg_break_cycles.py index 03eab0623..c8ac2f4d2 100755 --- a/test_regress/t/t_dfg_break_cycles.py +++ b/test_regress/t/t_dfg_break_cycles.py @@ -14,15 +14,13 @@ import os test.scenarios('vlt_all') test.sim_time = 2000000 -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") # Read expected source lines hit expectedLines = set() -with open(root + "/src/V3DfgBreakCycles.cpp", 'r', encoding="utf8") as fd: +with open(test.root + "/src/V3DfgBreakCycles.cpp", 'r', encoding="utf8") as fd: for lineno, line in enumerate(fd, 1): line = line.split("//")[0] if re.match(r'^[^#]*SET_RESULT', line): diff --git a/test_regress/t/t_dfg_peephole.py b/test_regress/t/t_dfg_peephole.py index 204b59116..a72381d72 100755 --- a/test_regress/t/t_dfg_peephole.py +++ b/test_regress/t/t_dfg_peephole.py @@ -12,9 +12,7 @@ import vltest_bootstrap test.scenarios('vlt_all') test.sim_time = 2000000 -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") # Read optimizations diff --git a/test_regress/t/t_dfg_synthesis.py b/test_regress/t/t_dfg_synthesis.py index 6d767dc14..51d9aa16c 100755 --- a/test_regress/t/t_dfg_synthesis.py +++ b/test_regress/t/t_dfg_synthesis.py @@ -12,9 +12,7 @@ import vltest_bootstrap test.scenarios('vlt_all') test.sim_time = 2000000 -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") # Generate the equivalence checks and declaration boilerplate diff --git a/test_regress/t/t_dfg_synthesis_pre_inline.py b/test_regress/t/t_dfg_synthesis_pre_inline.py index 011b93e99..2da0d567d 100755 --- a/test_regress/t/t_dfg_synthesis_pre_inline.py +++ b/test_regress/t/t_dfg_synthesis_pre_inline.py @@ -12,9 +12,7 @@ import vltest_bootstrap test.scenarios('vlt_all') test.sim_time = 2000000 -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") # Generate the equivalence checks and declaration boilerplate diff --git a/test_regress/t/t_dist_attributes_bad.py b/test_regress/t/t_dist_attributes_bad.py index 1fca2d090..a9144d8df 100755 --- a/test_regress/t/t_dist_attributes_bad.py +++ b/test_regress/t/t_dist_attributes_bad.py @@ -12,8 +12,6 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - def have_clang_check(): cmd = 'python3 -c "from clang.cindex import Index; index = Index.create(); print(\\"Clang imported\\")";' @@ -27,15 +25,15 @@ def have_clang_check(): if 'VERILATOR_TEST_NO_ATTRIBUTES' in os.environ: test.skip("Skipping due to VERILATOR_TEST_NO_ATTRIBUTES") -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") if not have_clang_check(): test.skip("No libclang installed") -aroot = os.path.abspath(root) +aroot = os.path.abspath(test.root) ccjson_file = test.obj_dir + "/compile_commands.json" -aroot_dir = os.path.abspath(root) +aroot_dir = os.path.abspath(test.root) srcs_dir = os.path.abspath("./t/t_dist_attributes") common_args = [ "clang++", "-std=c++14", "-I" + aroot_dir + "/include", "-I" + aroot_dir + "/src", "-c" diff --git a/test_regress/t/t_dist_cinclude.py b/test_regress/t/t_dist_cinclude.py index 7ecafce76..1300a6f0e 100755 --- a/test_regress/t/t_dist_cinclude.py +++ b/test_regress/t/t_dist_cinclude.py @@ -11,13 +11,11 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") ### Must trim output before and after our file list -cmd = "cd " + root + " && git ls-files --exclude-standard" +cmd = "cd " + test.root + " && git ls-files --exclude-standard" files = test.run_capture(cmd) if test.verbose: print("ST " + files) @@ -29,7 +27,7 @@ for filename in files.split(): continue if "test_regress/t/uvm/dpi/" in filename: # Standard file - can't change it continue - filename = os.path.join(root, filename) + filename = os.path.join(test.root, filename) if not os.path.exists(filename): continue with open(filename, 'r', encoding='latin-1') as fh: diff --git a/test_regress/t/t_dist_contributors.py b/test_regress/t/t_dist_contributors.py index ec12fa53d..309ed2d66 100755 --- a/test_regress/t/t_dist_contributors.py +++ b/test_regress/t/t_dist_contributors.py @@ -11,8 +11,6 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - Contributors = {'github action': True} Authors = {} @@ -27,7 +25,7 @@ def read_contributors(filename): def read_user(): - cmd = "cd " + root + " && git diff-index --quiet HEAD --" + cmd = "cd " + test.root + " && git diff-index --quiet HEAD --" changes = test.run_capture(cmd, check=False) changes = changes.rstrip() if changes == "": @@ -51,7 +49,7 @@ def read_authors(): def check(): - read_contributors(root + "/docs/CONTRIBUTORS") + read_contributors(test.root + "/docs/CONTRIBUTORS") read_user() read_authors() for author in sorted(Authors.keys()): @@ -80,7 +78,7 @@ def check(): if 'VERILATOR_TEST_NO_CONTRIBUTORS' in os.environ: test.skip("Skipping due to VERILATOR_TEST_NO_CONTRIBUTORS") -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") check() diff --git a/test_regress/t/t_dist_copyright.py b/test_regress/t/t_dist_copyright.py index dab107117..d2efab4f1 100755 --- a/test_regress/t/t_dist_copyright.py +++ b/test_regress/t/t_dist_copyright.py @@ -51,16 +51,14 @@ EXEMPT_FILES_LIST = """ verilator.pc.in """ -root = ".." - Exempt_Files_List_Re = list(map(re.escape, EXEMPT_FILES_LIST.split())) Exempt_Files_List_Re = '^(' + '|'.join(Exempt_Files_List_Re) + ")" # pprint(Exempt_Files_List_Re) -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") -cmd = "cd " + root + " && git ls-files --exclude-standard" +cmd = "cd " + test.root + " && git ls-files --exclude-standard" out = test.run_capture(cmd) year = datetime.datetime.now().year @@ -75,7 +73,7 @@ for filename in out.split(): files[filename] = True for filename in files: - open_filename = os.path.join(root, filename) + open_filename = os.path.join(test.root, filename) if not os.path.exists(open_filename): continue with open(open_filename, 'r', encoding="utf8") as fh: diff --git a/test_regress/t/t_dist_cppstyle.py b/test_regress/t/t_dist_cppstyle.py index a522fe10c..f473f18fb 100755 --- a/test_regress/t/t_dist_cppstyle.py +++ b/test_regress/t/t_dist_cppstyle.py @@ -11,11 +11,9 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - -def get_source_files(root): - git_files = test.run_capture("cd " + root + " && git ls-files") +def get_source_files(): + git_files = test.run_capture("cd " + test.root + " && git ls-files") if test.verbose: print("MF " + git_files) files = {} @@ -48,13 +46,13 @@ def check_pattern(filename, contents, pattern, not_pattern, message): buffer = "\n" -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") -files = get_source_files(root) +files = get_source_files() for filename in sorted(files.keys()): - filename = os.path.join(root, filename) + filename = os.path.join(test.root, filename) if not os.path.exists(filename): # git file might be deleted but not yet staged continue if not re.search(r'\.(h|c|cpp)(\.in)?$', filename): diff --git a/test_regress/t/t_dist_docs_style.py b/test_regress/t/t_dist_docs_style.py index 049bbd2f5..3b2a7f3b8 100755 --- a/test_regress/t/t_dist_docs_style.py +++ b/test_regress/t/t_dist_docs_style.py @@ -11,11 +11,9 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - -def get_source_files(root): - git_files = test.run_capture("cd " + root + " && git ls-files") +def get_source_files(): + git_files = test.run_capture("cd " + test.root + " && git ls-files") if test.verbose: print("MF " + git_files) files = {} @@ -100,14 +98,14 @@ def _option_sort_key(opt): ##### -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") ### Must trim output before and after our file list -files = get_source_files(root) +files = get_source_files() for filename in sorted(files.keys()): - filename = os.path.join(root, filename) + filename = os.path.join(test.root, filename) if not os.path.exists(filename): # git file might be deleted but not yet staged continue if not re.search(r'\.rst$', filename): diff --git a/test_regress/t/t_dist_docs_summary.py b/test_regress/t/t_dist_docs_summary.py index c8576c6f5..a0eb4aa41 100755 --- a/test_regress/t/t_dist_docs_summary.py +++ b/test_regress/t/t_dist_docs_summary.py @@ -11,8 +11,6 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - Waivers = [ '+verilator+prof+threads+file+', # Deprecated '+verilator+prof+threads+start+', # Deprecated @@ -25,9 +23,9 @@ Waivers = [ ] -def get_summary_opts(root): +def get_summary_opts(): args = {} - for filename in test.glob_some(root + "/bin/*"): + for filename in test.glob_some(test.root + "/bin/*"): with open(filename, "r", encoding="latin-1") as fh: on = False lineno = 0 @@ -53,9 +51,9 @@ def get_summary_opts(root): return args -def get_docs_opts(root): +def get_docs_opts(): args = {} - for filename in test.glob_some(root + "/docs/guide/*.rst"): + for filename in test.glob_some(test.root + "/docs/guide/*.rst"): with open(filename, "r", encoding="latin-1") as fh: lineno = 0 for line in fh: @@ -91,11 +89,11 @@ def alt_names(opt): return opts -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") -sums = get_summary_opts(root) -docs = get_docs_opts(root) +sums = get_summary_opts() +docs = get_docs_opts() both = {} both.update(sums) diff --git a/test_regress/t/t_dist_docs_warnings.py b/test_regress/t/t_dist_docs_warnings.py index 89fb624ec..94e9eca9a 100755 --- a/test_regress/t/t_dist_docs_warnings.py +++ b/test_regress/t/t_dist_docs_warnings.py @@ -11,8 +11,6 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - Waivers = [ 'Internal', 'Unsupported', @@ -23,9 +21,9 @@ src_filename = "src/V3Error.h" doc_filename = "docs/guide/warnings.rst" -def get_src_warns(root): +def get_src_warns(): args = {} - for filename in test.glob_some(root + "/" + src_filename): + for filename in test.glob_some(test.root + "/" + src_filename): with open(filename, "r", encoding="latin-1") as fh: state = 0 lineno = 0 @@ -49,9 +47,9 @@ def get_src_warns(root): return args -def get_docs_warns(root): +def get_docs_warns(): args = {} - for filename in test.glob_some(root + "/" + doc_filename): + for filename in test.glob_some(test.root + "/" + doc_filename): with open(filename, "r", encoding="latin-1") as fh: lineno = 0 last_opt = None @@ -77,11 +75,11 @@ def opt_clean(opt): return opt -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") -srcs = get_src_warns(root) -docs = get_docs_warns(root) +srcs = get_src_warns() +docs = get_docs_warns() if len(srcs) < 10: test.error(src_filename + ": Too few warnings found; parse error?") if len(docs) < 10: diff --git a/test_regress/t/t_dist_error_format.py b/test_regress/t/t_dist_error_format.py index 22d43d46b..fe06aaddf 100755 --- a/test_regress/t/t_dist_error_format.py +++ b/test_regress/t/t_dist_error_format.py @@ -11,14 +11,12 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - # Check all error messages match our standard format # This assumes .out files cover all important errors def formats(): - files = root + "/test_regress/t/*.out" + files = test.root + "/test_regress/t/*.out" warns = {} lnmatch = 0 for filename in test.glob_some(files): @@ -67,7 +65,7 @@ def formats(): test.error_keep_going(warns[filename]) -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") formats() diff --git a/test_regress/t/t_dist_fixme.py b/test_regress/t/t_dist_fixme.py index 168ab7e9e..6aa19f1ae 100755 --- a/test_regress/t/t_dist_fixme.py +++ b/test_regress/t/t_dist_fixme.py @@ -11,13 +11,11 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") ### Must trim output before and after our file list -files = test.run_capture("cd " + root + " && git ls-files --exclude-standard") +files = test.run_capture("cd " + test.root + " && git ls-files --exclude-standard") if test.verbose: print("ST " + files) @@ -28,7 +26,7 @@ regex = r'(FIX[M]E|BO[Z]O)' for filename in files.split(): if re.search(regex, filename): names[filename] = True - filename = os.path.join(root, filename) + filename = os.path.join(test.root, filename) if not os.path.exists(filename): continue wholefile = test.file_contents(filename) diff --git a/test_regress/t/t_dist_getsetorder.py b/test_regress/t/t_dist_getsetorder.py index 350c77136..ee921e959 100755 --- a/test_regress/t/t_dist_getsetorder.py +++ b/test_regress/t/t_dist_getsetorder.py @@ -12,11 +12,9 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - -def get_source_files(root): - git_files = test.run_capture("cd " + root + " && git ls-files") +def get_source_files(): + git_files = test.run_capture("cd " + test.root + " && git ls-files") if test.verbose: print("MF " + git_files) files = {} @@ -27,14 +25,14 @@ def get_source_files(root): return files -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") ### Must trim output before and after our file list -files = get_source_files(root) +files = get_source_files() for filename in sorted(files.keys()): - filename = os.path.join(root, filename) + filename = os.path.join(test.root, filename) if not os.path.exists(filename): # git file might be deleted but not yet staged continue if not re.search(r'include.*verilated.*\.[ch].*$', filename): diff --git a/test_regress/t/t_dist_header_cc.py b/test_regress/t/t_dist_header_cc.py index c25395442..2793c77a7 100755 --- a/test_regress/t/t_dist_header_cc.py +++ b/test_regress/t/t_dist_header_cc.py @@ -11,13 +11,11 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.run(cmd=[ - "cd " + root + "/src/obj_dbg && " + os.environ['MAKE'] + + "cd " + test.root + "/src/obj_dbg && " + os.environ['MAKE'] + " -j 4 -k -f ../Makefile_obj VL_NOOPT=1 header_cc" ], check_finished=False) diff --git a/test_regress/t/t_dist_install.py b/test_regress/t/t_dist_install.py index 84bfabc16..4c21c353e 100755 --- a/test_regress/t/t_dist_install.py +++ b/test_regress/t/t_dist_install.py @@ -11,9 +11,7 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") cwd = os.getcwd() @@ -24,8 +22,9 @@ test.run(cmd=["rm -rf " + destdir + " && mkdir -p " + destdir], check_finished=F # Install into temp area print("Install...") -test.run(cmd=["cd " + root + " && " + os.environ["MAKE"] + " DESTDIR=" + destdir + " install-all"], - check_finished=False) +test.run( + cmd=["cd " + test.root + " && " + os.environ["MAKE"] + " DESTDIR=" + destdir + " install-all"], + check_finished=False) # Check we can run a test # Unfortunately the prefix was hardcoded in the exec at a different place, @@ -34,8 +33,9 @@ test.run(cmd=["cd " + root + " && " + os.environ["MAKE"] + " DESTDIR=" + destdir # Uninstall print("Uninstall...\n") -test.run(cmd=["cd " + root + " && " + os.environ["MAKE"] + " DESTDIR=" + destdir + " uninstall"], - check_finished=False) +test.run( + cmd=["cd " + test.root + " && " + os.environ["MAKE"] + " DESTDIR=" + destdir + " uninstall"], + check_finished=False) # Check empty files = [] diff --git a/test_regress/t/t_dist_lint_py.py b/test_regress/t/t_dist_lint_py.py index f011fb1f8..8ed3c11be 100755 --- a/test_regress/t/t_dist_lint_py.py +++ b/test_regress/t/t_dist_lint_py.py @@ -11,13 +11,11 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - if 'VERILATOR_TEST_NO_LINT_PY' in os.environ: test.skip("Skipping due to VERILATOR_TEST_NO_LINT_PY") -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") -test.run(cmd=["cd " + root + " && " + os.environ["MAKE"] + " lint-py"]) +test.run(cmd=["cd " + test.root + " && " + os.environ["MAKE"] + " lint-py"]) test.passes() diff --git a/test_regress/t/t_dist_pl.py b/test_regress/t/t_dist_pl.py index f0bc335a2..365ef0f0d 100755 --- a/test_regress/t/t_dist_pl.py +++ b/test_regress/t/t_dist_pl.py @@ -11,9 +11,7 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - -for pl in sorted(glob.glob(root + "/test_regress/t/*.pl")): +for pl in sorted(glob.glob(test.root + "/test_regress/t/*.pl")): if 'bootstrap.pl' in pl: continue py = re.sub(r'\.pl', '.py', pl) diff --git a/test_regress/t/t_dist_portability.py b/test_regress/t/t_dist_portability.py index d76293db6..6d9f76c80 100755 --- a/test_regress/t/t_dist_portability.py +++ b/test_regress/t/t_dist_portability.py @@ -11,8 +11,6 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - def line_filename(line): m = re.search(r'^([^:]+)', line) @@ -21,7 +19,7 @@ def line_filename(line): def printfll(): files = "src/*.c* src/*.h include/*.c* include/*.h examples/*/*.c* test_regress/t/*.c* test_regress/t/*.h" - cmd = "cd " + root + " && fgrep -n ll " + files + " | sort" + cmd = "cd " + test.root + " && fgrep -n ll " + files + " | sort" grep = test.run_capture(cmd, check=False) names = {} for line in grep.splitlines(): @@ -37,7 +35,7 @@ def printfll(): def cstr(): files = "src/*.c* src/*.h include/*.c* include/*.h examples/*/*.c* test_regress/t/*.c* test_regress/t/*.h" - cmd = "cd " + root + " && grep -n -P 'c_str|begin|end' " + files + " | sort" + cmd = "cd " + test.root + " && grep -n -P 'c_str|begin|end' " + files + " | sort" grep = test.run_capture(cmd, check=False) names = {} for line in grep.splitlines(): @@ -54,7 +52,7 @@ def cstr(): def vsnprintf(): # Note do not do test_regress, as VPI files need to compile without verilatedos.h files = "src/*.c* src/*.h include/*.c* include/*.h examples/*/*.c*" - cmd = "cd " + root + " && grep -n -P '(snprintf|vsnprintf)' " + files + " | sort" + cmd = "cd " + test.root + " && grep -n -P '(snprintf|vsnprintf)' " + files + " | sort" grep = test.run_capture(cmd, check=False) names = {} for line in grep.splitlines(): @@ -70,7 +68,7 @@ def vsnprintf(): def final(): # Note do not do test_regress, as VPI files need to compile without verilatedos.h files = "src/*.c* src/*.h include/*.c* include/*.h" - cmd = "cd " + root + " && grep -n -P '(class|struct)' " + files + " | sort" + cmd = "cd " + test.root + " && grep -n -P '(class|struct)' " + files + " | sort" grep = test.run_capture(cmd, check=False) names = {} for line in grep.splitlines(): @@ -89,7 +87,7 @@ def final(): ' '.join(sorted(names.keys()))) -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") printfll() diff --git a/test_regress/t/t_dist_untracked.py b/test_regress/t/t_dist_untracked.py index 15545b1d1..52ce71974 100755 --- a/test_regress/t/t_dist_untracked.py +++ b/test_regress/t/t_dist_untracked.py @@ -11,16 +11,14 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") ### Must trim output before and after our file list warns = {} summary = None -status = test.run_capture("cd " + root + " && git ls-files -o --exclude-standard") +status = test.run_capture("cd " + test.root + " && git ls-files -o --exclude-standard") if test.verbose: print("-ST " + status) diff --git a/test_regress/t/t_dist_warn_coverage.py b/test_regress/t/t_dist_warn_coverage.py index 6361676f0..8ba8ac79a 100755 --- a/test_regress/t/t_dist_warn_coverage.py +++ b/test_regress/t/t_dist_warn_coverage.py @@ -11,8 +11,6 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - Messages = {} Outputs = {} Suppressed = {} @@ -114,7 +112,7 @@ for s in [ def read_messages(): - for filename in test.glob_some(root + "/src/*"): + for filename in test.glob_some(test.root + "/src/*"): if not os.path.isfile(filename): continue with open(filename, 'r', encoding="utf8") as fh: @@ -156,9 +154,9 @@ def read_messages(): def read_outputs(): - for filename in (test.glob_some(root + "/test_regress/t/*.py") + - test.glob_some(root + "/test_regress/t/*.out") + - test.glob_some(root + "/docs/gen/*.rst")): + for filename in (test.glob_some(test.root + "/test_regress/t/*.py") + + test.glob_some(test.root + "/test_regress/t/*.out") + + test.glob_some(test.root + "/docs/gen/*.rst")): if "t_dist_warn_coverage" in filename: # Avoid our own suppressions continue with open(filename, 'r', encoding="latin-1") as fh: @@ -224,7 +222,7 @@ def check(): print() -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") check() diff --git a/test_regress/t/t_dist_whitespace.py b/test_regress/t/t_dist_whitespace.py index 3a6ae33be..d4a22288b 100755 --- a/test_regress/t/t_dist_whitespace.py +++ b/test_regress/t/t_dist_whitespace.py @@ -11,13 +11,11 @@ import vltest_bootstrap test.scenarios('dist') -root = ".." - Tabs_Exempt_Re = r'(\.out$)|(/gtkwave)|(Makefile)|(\.mk$)|(\.mk\.in$)|test_regress/t/t_preproc\.v|install-sh' -def get_source_files(root): - git_files = test.run_capture("cd " + root + " && git ls-files") +def get_source_files(): + git_files = test.run_capture("cd " + test.root + " && git ls-files") if test.verbose: print("MF " + git_files) files = {} @@ -28,17 +26,15 @@ def get_source_files(root): return files -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") -root = ".." - -files = get_source_files(root) +files = get_source_files() warns = {} fcount = 0 for filename in sorted(files.keys()): - filename = os.path.join(root, filename) + filename = os.path.join(test.root, filename) if not os.path.exists(filename): # git file might be deleted but not yet staged continue contents = test.file_contents(filename) diff --git a/test_regress/t/t_event_control_star_never_bad.py b/test_regress/t/t_event_control_star_never_bad.py index ec7fab69d..a2b567e13 100755 --- a/test_regress/t/t_event_control_star_never_bad.py +++ b/test_regress/t/t_event_control_star_never_bad.py @@ -12,19 +12,17 @@ import vltest_bootstrap test.scenarios('linter') test.top_filename = 't/t_event_control_star_never.v' -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.lint(verilator_flags2=['--timing'], fails=True, expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_ALWNEVER_faulty.rst", + out_filename=test.root + "/docs/gen/ex_ALWNEVER_faulty.rst", lines="9-9") test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_ALWNEVER_msg.rst", + out_filename=test.root + "/docs/gen/ex_ALWNEVER_msg.rst", lines="1-1") test.passes() diff --git a/test_regress/t/t_lint_assigneqexpr_bad.py b/test_regress/t/t_lint_assigneqexpr_bad.py index 8b0058925..f6a8acb6f 100755 --- a/test_regress/t/t_lint_assigneqexpr_bad.py +++ b/test_regress/t/t_lint_assigneqexpr_bad.py @@ -12,18 +12,16 @@ import vltest_bootstrap test.scenarios('vlt') test.top_filename = "t/t_lint_assigneqexpr.v" -root = ".." - test.lint(verilator_flags2=['-Wall -Wno-DECLFILENAME'], fails=True, expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_ASSIGNEQEXPR_faulty.rst", + out_filename=test.root + "/docs/gen/ex_ASSIGNEQEXPR_faulty.rst", lines="26-29") test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_ASSIGNEQEXPR_msg.rst", + out_filename=test.root + "/docs/gen/ex_ASSIGNEQEXPR_msg.rst", lines="7-8") test.passes() diff --git a/test_regress/t/t_lint_badvltpragma_bad.py b/test_regress/t/t_lint_badvltpragma_bad.py index 1c907c181..fa175c1c4 100755 --- a/test_regress/t/t_lint_badvltpragma_bad.py +++ b/test_regress/t/t_lint_badvltpragma_bad.py @@ -11,19 +11,17 @@ import vltest_bootstrap test.scenarios('vlt') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.lint(fails=True, expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_BADVLTPRAGMA_faulty.rst", + out_filename=test.root + "/docs/gen/ex_BADVLTPRAGMA_faulty.rst", lines="7") test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_BADVLTPRAGMA_msg.rst", + out_filename=test.root + "/docs/gen/ex_BADVLTPRAGMA_msg.rst", lines="1-3") test.passes() diff --git a/test_regress/t/t_lint_didnotconverge_bad.py b/test_regress/t/t_lint_didnotconverge_bad.py index 62e56833c..0d6c4e194 100755 --- a/test_regress/t/t_lint_didnotconverge_bad.py +++ b/test_regress/t/t_lint_didnotconverge_bad.py @@ -11,9 +11,7 @@ import vltest_bootstrap test.scenarios('vlt') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.compile(verilator_flags2=["--prof-cfuncs"]) @@ -21,11 +19,11 @@ test.compile(verilator_flags2=["--prof-cfuncs"]) test.execute(fails=True, expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_DIDNOTCONVERGE_faulty.rst", + out_filename=test.root + "/docs/gen/ex_DIDNOTCONVERGE_faulty.rst", lines="16-17") test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_DIDNOTCONVERGE_msg.rst", + out_filename=test.root + "/docs/gen/ex_DIDNOTCONVERGE_msg.rst", lines="1-2") test.passes() diff --git a/test_regress/t/t_lint_didnotconverge_nodbg_bad.py b/test_regress/t/t_lint_didnotconverge_nodbg_bad.py index 4ca34912b..abd364a14 100755 --- a/test_regress/t/t_lint_didnotconverge_nodbg_bad.py +++ b/test_regress/t/t_lint_didnotconverge_nodbg_bad.py @@ -12,9 +12,7 @@ import vltest_bootstrap test.scenarios('vlt') test.top_filename = "t/t_lint_didnotconverge_bad.v" -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.compile(make_flags=['CPPFLAGS_ADD=-UVL_DEBUG']) @@ -22,7 +20,7 @@ test.compile(make_flags=['CPPFLAGS_ADD=-UVL_DEBUG']) test.execute(fails=True, expect_filename=test.golden_filename) test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_DIDNOTCONVERGE_nodbg_msg.rst", + out_filename=test.root + "/docs/gen/ex_DIDNOTCONVERGE_nodbg_msg.rst", lines="1") test.passes() diff --git a/test_regress/t/t_lint_multidriven_bad.py b/test_regress/t/t_lint_multidriven_bad.py index f84ef04a2..c34cc857e 100755 --- a/test_regress/t/t_lint_multidriven_bad.py +++ b/test_regress/t/t_lint_multidriven_bad.py @@ -11,19 +11,17 @@ import vltest_bootstrap test.scenarios('linter') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.lint(fails=True, expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_MULTIDRIVEN_faulty.rst", + out_filename=test.root + "/docs/gen/ex_MULTIDRIVEN_faulty.rst", lines="31-36") test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_MULTIDRIVEN_msg.rst", + out_filename=test.root + "/docs/gen/ex_MULTIDRIVEN_msg.rst", lines="10,11,14") test.passes() diff --git a/test_regress/t/t_lint_paramnodefault_bad.py b/test_regress/t/t_lint_paramnodefault_bad.py index a39dc08aa..5463b1a05 100755 --- a/test_regress/t/t_lint_paramnodefault_bad.py +++ b/test_regress/t/t_lint_paramnodefault_bad.py @@ -12,19 +12,17 @@ import vltest_bootstrap test.scenarios('linter') test.top_filename = 't/t_lint_paramnodefault.v' -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.lint(fails=True, expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_PARAMNODEFAULT_faulty.rst", + out_filename=test.root + "/docs/gen/ex_PARAMNODEFAULT_faulty.rst", lines="7-8") test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_PARAMNODEFAULT_msg.rst", + out_filename=test.root + "/docs/gen/ex_PARAMNODEFAULT_msg.rst", lines="1-3") test.passes() diff --git a/test_regress/t/t_lint_pinmissing_bad.py b/test_regress/t/t_lint_pinmissing_bad.py index 78a6d6a13..b02a8247f 100755 --- a/test_regress/t/t_lint_pinmissing_bad.py +++ b/test_regress/t/t_lint_pinmissing_bad.py @@ -11,19 +11,17 @@ import vltest_bootstrap test.scenarios('linter') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.lint(fails=True, expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_PINMISSING_faulty.rst", + out_filename=test.root + "/docs/gen/ex_PINMISSING_faulty.rst", lines="7-12") test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_PINMISSING_msg.rst", + out_filename=test.root + "/docs/gen/ex_PINMISSING_msg.rst", lines="1-1") test.passes() diff --git a/test_regress/t/t_lint_procassinit_bad.py b/test_regress/t/t_lint_procassinit_bad.py index 28f124234..cb0745ee1 100755 --- a/test_regress/t/t_lint_procassinit_bad.py +++ b/test_regress/t/t_lint_procassinit_bad.py @@ -11,9 +11,7 @@ import vltest_bootstrap test.scenarios('vlt') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.lint(verilator_flags2=['-Wall -Wno-DECLFILENAME'], @@ -21,15 +19,15 @@ test.lint(verilator_flags2=['-Wall -Wno-DECLFILENAME'], expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_PROCASSINIT_faulty.rst", + out_filename=test.root + "/docs/gen/ex_PROCASSINIT_faulty.rst", lines="26-32") test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_PROCASSINIT_fixed.rst", + out_filename=test.root + "/docs/gen/ex_PROCASSINIT_fixed.rst", lines="36-45") test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_PROCASSINIT_msg.rst", + out_filename=test.root + "/docs/gen/ex_PROCASSINIT_msg.rst", lines="1-9") test.passes() diff --git a/test_regress/t/t_lint_stmtdly_bad.py b/test_regress/t/t_lint_stmtdly_bad.py index 953505d81..b7752cc94 100755 --- a/test_regress/t/t_lint_stmtdly_bad.py +++ b/test_regress/t/t_lint_stmtdly_bad.py @@ -11,19 +11,17 @@ import vltest_bootstrap test.scenarios('vlt') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.lint(verilator_flags2=["--no-timing"], fails=True, expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_STMTDLY_faulty.rst", + out_filename=test.root + "/docs/gen/ex_STMTDLY_faulty.rst", lines="10") test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_STMTDLY_msg.rst", + out_filename=test.root + "/docs/gen/ex_STMTDLY_msg.rst", lines="1") test.passes() diff --git a/test_regress/t/t_lint_widthexpand_docs_bad.py b/test_regress/t/t_lint_widthexpand_docs_bad.py index 6d7a81fa7..f9013b153 100755 --- a/test_regress/t/t_lint_widthexpand_docs_bad.py +++ b/test_regress/t/t_lint_widthexpand_docs_bad.py @@ -11,9 +11,7 @@ import vltest_bootstrap test.scenarios('linter') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.lint(verilator_flags2=["--lint-only"], @@ -21,16 +19,16 @@ test.lint(verilator_flags2=["--lint-only"], expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_WIDTHEXPAND_1_faulty.rst", + out_filename=test.root + "/docs/gen/ex_WIDTHEXPAND_1_faulty.rst", lines="8-10") test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_WIDTHEXPAND_1_msg.rst", + out_filename=test.root + "/docs/gen/ex_WIDTHEXPAND_1_msg.rst", lineno_adjust=-7, regexp=r'Warning-WIDTH') test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_WIDTHEXPAND_1_fixed.rst", + out_filename=test.root + "/docs/gen/ex_WIDTHEXPAND_1_fixed.rst", lines="18") test.passes() diff --git a/test_regress/t/t_var_bad_hide_docs.py b/test_regress/t/t_var_bad_hide_docs.py index 837cb2dc9..470ff9c36 100755 --- a/test_regress/t/t_var_bad_hide_docs.py +++ b/test_regress/t/t_var_bad_hide_docs.py @@ -11,9 +11,7 @@ import vltest_bootstrap test.scenarios('linter') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.lint(verilator_flags2=["--lint-only -Wwarn-VARHIDDEN"], @@ -21,11 +19,11 @@ test.lint(verilator_flags2=["--lint-only -Wwarn-VARHIDDEN"], expect_filename=test.golden_filename) test.extract(in_filename=test.top_filename, - out_filename=root + "/docs/gen/ex_VARHIDDEN_faulty.rst", + out_filename=test.root + "/docs/gen/ex_VARHIDDEN_faulty.rst", regexp=r'(module t|integer|endmodule)') test.extract(in_filename=test.golden_filename, - out_filename=root + "/docs/gen/ex_VARHIDDEN_msg.rst", + out_filename=test.root + "/docs/gen/ex_VARHIDDEN_msg.rst", lineno_adjust=-6, regexp=r'(var_bad_hide)') diff --git a/test_regress/t/t_verilated_all.py b/test_regress/t/t_verilated_all.py index e78a65173..86812d347 100755 --- a/test_regress/t/t_verilated_all.py +++ b/test_regress/t/t_verilated_all.py @@ -11,9 +11,7 @@ import vltest_bootstrap test.scenarios('vltmt') -root = ".." - -if not os.path.exists(root + "/.git"): +if not os.path.exists(test.root + "/.git"): test.skip("Not in a git repository") test.compile( @@ -22,7 +20,7 @@ test.compile( "--cc", "--coverage-toggle --coverage-line --coverage-user", "--trace-vcd --vpi ", "--trace-threads 1", ("--timing" if test.have_coroutines else "--no-timing -Wno-STMTDLY"), "--prof-exec", - "--prof-pgo", root + "/include/verilated_save.cpp" + "--prof-pgo", test.root + "/include/verilated_save.cpp" ], threads=2) @@ -30,7 +28,8 @@ test.execute( all_run_flags=[" +verilator+prof+exec+file+/dev/null", " +verilator+prof+vlt+file+/dev/null"]) hit = {} -for filename in (test.glob_some(root + "/include/*.cpp") + test.glob_some(root + "/include/*.h")): +for filename in (test.glob_some(test.root + "/include/*.cpp") + + test.glob_some(test.root + "/include/*.h")): filename = os.path.basename(filename) if test.verbose: print("NEED: " + filename) diff --git a/test_regress/t/t_verilated_all_newest.py b/test_regress/t/t_verilated_all_newest.py index 99b357595..0bfa92b93 100755 --- a/test_regress/t/t_verilated_all_newest.py +++ b/test_regress/t/t_verilated_all_newest.py @@ -12,13 +12,11 @@ import vltest_bootstrap test.scenarios('vlt') test.top_filename = "t/t_verilated_all.v" -root = ".." - test.compile( # Can't use --coverage and --savable together, so cheat and compile inline verilator_flags2=[ "--cc --coverage-toggle --coverage-line --coverage-user --trace-vcd --prof-exec --prof-pgo --vpi " - + root + "/include/verilated_save.cpp", + + test.root + "/include/verilated_save.cpp", ("--timing" if test.have_coroutines else "--no-timing -Wno-STMTDLY") ], make_flags=['DRIVER_STD=newest']) diff --git a/test_regress/t/t_verilated_threaded.py b/test_regress/t/t_verilated_threaded.py index f871f925e..f8371587a 100755 --- a/test_regress/t/t_verilated_threaded.py +++ b/test_regress/t/t_verilated_threaded.py @@ -12,13 +12,11 @@ import vltest_bootstrap test.scenarios('vltmt') test.top_filename = "t/t_verilated_all.v" -root = ".." - test.compile( # Can't use --coverage and --savable together, so cheat and compile inline verilator_flags2=[ "--cc --coverage-toggle --coverage-line --coverage-user --trace-vcd --vpi", - root + "/include/verilated_save.cpp", + test.root + "/include/verilated_save.cpp", ("--timing" if test.have_coroutines else "--no-timing -Wno-STMTDLY") ], threads=1)