Improve testing on FreeBSD (#6328)

* Skip profiling tests on non-glibc platforms

* Enforce dumb terminal in tests

* Include POSIX headers whenever __unix__ macro is defined

* Treat no procfs as normal condition

* Respect MAKE variable when running make
This commit is contained in:
Aleksander Kiryk 2025-08-23 16:49:03 +02:00 committed by GitHub
parent 353a2e3d20
commit a9aa2f11b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 55 additions and 20 deletions

View File

@ -72,7 +72,7 @@
# include <execinfo.h>
# define _VL_HAVE_STACKTRACE
#endif
#if defined(__linux) || (defined(__APPLE__) && defined(__MACH__))
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
# include <sys/time.h>
# include <sys/resource.h>
# define _VL_HAVE_GETRLIMIT

View File

@ -2809,6 +2809,7 @@ if __name__ == '__main__':
if 'TEST_REGRESS' in os.environ:
sys.exit("%Error: TEST_REGRESS environment variable is already set")
os.environ['TEST_REGRESS'] = os.getcwd()
os.environ['TERM'] = "dumb"
Start = time.time()
_Parameter_Next_Level = None

View File

@ -31,8 +31,8 @@ test.files_identical(report, "t/" + test.name + "__ccache_report_initial.out")
# Now rebuild again (should be all up to date)
test.run(logfile=test.obj_dir + "/rebuild.log",
cmd=[
"make", "-C " + test.obj_dir, "-f " + test.vm_prefix + ".mk", test.vm_prefix,
"ccache-report"
os.environ["MAKE"], "-C " + test.obj_dir, "-f " + test.vm_prefix + ".mk",
test.vm_prefix, "ccache-report"
])
test.files_identical(report, "t/" + test.name + "__ccache_report_rebuild.out")

View File

@ -18,6 +18,6 @@ if 'VERILATOR_TEST_NO_LINT_PY' in os.environ:
if not os.path.exists(root + "/.git"):
test.skip("Not in a git repository")
test.run(cmd=["cd " + root + " && make lint-py"])
test.run(cmd=["cd " + root + " && " + os.environ["MAKE"] + " lint-py"])
test.passes()

View File

@ -38,7 +38,7 @@ for trial in range(0, trials):
])
test.file_grep(gantt_log, r'CPU info:')
test.file_grep(gantt_log, r'NUMA status += assigned')
test.file_grep(gantt_log, r'NUMA status += (assigned|%Warning: no /proc/cpuinfo)')
# False fails occasionally
# test.file_grep_not(gantt_log, r'%Warning:') # e.g. There were fewer CPUs (1) than threads (3).

View File

@ -14,6 +14,8 @@ test.scenarios('vlt_all')
if re.search(r'clang', test.cxx_version) and 'aarch64' in platform.processor():
test.skip("Known compiler profile issues on clang aarch64")
if platform.libc_ver()[0] != "glibc":
test.skip("The test depends on GMON_OUT_PREFIX which is glibc-specific")
test.compile(verilator_flags2=["--stats --prof-cfuncs +define+T_PROF"])

View File

@ -15,6 +15,8 @@ test.top_filename = "t/t_prof.v"
if re.search(r'clang', test.cxx_version) and 'aarch64' in platform.processor():
test.skip("Known compiler profile issues on clang aarch64")
if platform.libc_ver()[0] != "glibc":
test.skip("The test depends on GMON_OUT_PREFIX which is glibc-specific")
# TODO below might no longer be required as configure checks for -pg
if 'VERILATOR_TEST_NO_GPROF' in os.environ:

View File

@ -8,10 +8,16 @@
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
import platform
test.scenarios('vlt')
test.top_filename = "t_prof.v"
if re.search(r'clang', test.cxx_version) and 'aarch64' in platform.processor():
test.skip("Known compiler profile issues on clang aarch64")
if platform.libc_ver()[0] != "glibc":
test.skip("The test depends on GMON_OUT_PREFIX which is glibc-specific")
test.compile(verilator_flags2=["--stats --prof-c +define+T_PROF"])
# TODO below might no longer be required as configure checks for -pg

View File

@ -20,9 +20,11 @@ test.compile(make_main=False,
vm_prefix='Vt_trace_two_b',
verilator_flags2=['-trace'])
test.run(
logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", "" + test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
test.run(logfile=test.obj_dir + "/make_first_ALL.log",
cmd=[
os.environ["MAKE"], "-C", "" + test.obj_dir, "-f", "Vt_trace_two_b.mk",
"Vt_trace_two_b__ALL.cpp"
])
test.compile(make_main=False,
top_filename='t_trace_two_a.v',

View File

@ -23,7 +23,10 @@ test.compile(make_main=False,
verilator_flags2=['-sc -trace'])
test.run(logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
cmd=[
os.environ["MAKE"], "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk",
"Vt_trace_two_b__ALL.cpp"
])
test.compile(make_main=False,
top_filename='t_trace_two_a.v',

View File

@ -21,7 +21,10 @@ test.compile(make_main=False,
verilator_flags2=['--trace-fst --trace-threads 1 -DTEST_FST'])
test.run(logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
cmd=[
os.environ["MAKE"], "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk",
"Vt_trace_two_b__ALL.cpp"
])
test.compile(
make_main=False,

View File

@ -21,7 +21,10 @@ test.compile(make_main=False,
verilator_flags2=['-trace'])
test.run(logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
cmd=[
os.environ["MAKE"], "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk",
"Vt_trace_two_b__ALL.cpp"
])
test.compile(make_main=False,
top_filename='t_trace_two_a.v',

View File

@ -23,7 +23,10 @@ test.compile(make_main=False,
verilator_flags2=['-sc -trace'])
test.run(logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
cmd=[
os.environ["MAKE"], "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk",
"Vt_trace_two_b__ALL.cpp"
])
test.compile(make_main=False,
top_filename='t_trace_two_a.v',

View File

@ -20,9 +20,11 @@ test.compile(make_main=False,
vm_prefix='Vt_trace_two_b',
verilator_flags2=['--trace-fst --trace-threads 1'])
test.run(
logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", "" + test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
test.run(logfile=test.obj_dir + "/make_first_ALL.log",
cmd=[
os.environ["MAKE"], "-C", "" + test.obj_dir, "-f", "Vt_trace_two_b.mk",
"Vt_trace_two_b__ALL.cpp"
])
test.compile(
make_main=False,

View File

@ -21,7 +21,10 @@ test.compile(make_main=False,
verilator_flags2=['-trace'])
test.run(logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
cmd=[
os.environ["MAKE"], "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk",
"Vt_trace_two_b__ALL.cpp"
])
test.compile(make_main=False,
top_filename='t_trace_two_a.v',

View File

@ -24,7 +24,10 @@ test.compile(make_main=False,
verilator_flags2=['-sc -trace'])
test.run(logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
cmd=[
os.environ["MAKE"], "-C", test.obj_dir, "-f", "Vt_trace_two_b.mk",
"Vt_trace_two_b__ALL.cpp"
])
test.compile(make_main=False,
top_filename='t_trace_two_a.v',

View File

@ -20,9 +20,11 @@ test.compile(make_main=False,
vm_prefix='Vt_trace_two_b',
verilator_flags2=['--trace-fst --trace-threads 1'])
test.run(
logfile=test.obj_dir + "/make_first_ALL.log",
cmd=["make", "-C", "" + test.obj_dir, "-f", "Vt_trace_two_b.mk", "Vt_trace_two_b__ALL.cpp"])
test.run(logfile=test.obj_dir + "/make_first_ALL.log",
cmd=[
os.environ["MAKE"], "-C", "" + test.obj_dir, "-f", "Vt_trace_two_b.mk",
"Vt_trace_two_b__ALL.cpp"
])
test.compile(
make_main=False,