Internals: Fix minor macOS issues

This commit is contained in:
Geza Lore 2025-11-23 11:04:51 +00:00
parent 28c78d3f9a
commit 6a83112380
5 changed files with 19 additions and 23 deletions

View File

@ -290,7 +290,7 @@ void VlPgoProfiler<N_Entries>::write(const char* modelp, const std::string& file
VL_DEBUG_IF(VL_DBG_MSGF("+prof+vlt+file writing to '%s'\n", filename.c_str()););
if (m_currentHierBlockCost) {
fprintf(fp, "profile_data -hier-dpi \"%s\" -cost 64'd%lu\n", modelp,
fprintf(fp, "profile_data -hier-dpi \"%s\" -cost 64'd%" PRIu64 "\n", modelp,
m_currentHierBlockCost);
}

View File

@ -2863,6 +2863,10 @@ def run_them() -> None:
if __name__ == '__main__':
os.environ['PYTHONUNBUFFERED'] = "1"
# GDB is broken on macOS
if platform.system() == "Darwin":
os.environ['VERILATOR_TEST_NO_GDB'] = "1"
if ('VERILATOR_ROOT' not in os.environ) and os.path.isfile('../bin/verilator'):
os.environ['VERILATOR_ROOT'] = os.getcwd() + "/.."
if 'MAKE' not in os.environ:

View File

@ -38,21 +38,11 @@ test.compile(
"t_flag_ldflags_a.a", "t_flag_ldflags_so.so"
])
# On OS X, LD_LIBRARY_PATH is ignored, so set rpath of the exe to find the .so
if sys.platform == "darwin":
test.run(cmd=[
"cd " + test.obj_dir + " && install_name_tool -add_rpath @executable_path/.",
test.vm_prefix
],
check_finished=False)
test.run(cmd=[
"cd " + test.obj_dir + " && install_name_tool -change t_flag_ldflags_so.so" +
" @rpath/t_flag_ldflags_so.so", test.vm_prefix
],
check_finished=False)
test.execute(run_env="LD_LIBRARY_PATH=" + test.obj_dir + ":" +
test.getenv_def("LD_LIBRARY_PATH", ""))
test.execute(run_env="DYLD_LIBRARY_PATH=" + test.obj_dir + ":" +
test.getenv_def("DYLD_LIBRARY_PATH", ""))
else:
test.execute(run_env="LD_LIBRARY_PATH=" + test.obj_dir + ":" +
test.getenv_def("LD_LIBRARY_PATH", ""))
test.passes()

View File

@ -10,6 +10,7 @@
# Test for bin/verilator_gantt,
import vltest_bootstrap
import sys
test.scenarios('vltmt')
test.top_filename = "t/t_gantt.v"
@ -38,9 +39,10 @@ for trial in range(0, trials):
"/profile_exec.dat", "| tee " + gantt_log
])
test.file_grep(gantt_log, r'CPU info:')
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).
if sys.platform != "darwin":
test.file_grep(gantt_log, r'CPU info:')
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).
test.passes()

View File

@ -259,13 +259,13 @@ void _arr_access_format_check(TestVpiHandle& reg_h, int wordSize, const int* low
strVal_s[spanSize] = '\0';
value_in.value.str = strVal_s;
} else if (format == vpiDecStrVal) {
sprintf(strVal_s, "%" PRIu64, intVal);
snprintf(strVal_s, MAX_SPANSIZE + 1, "%" PRIu64, intVal);
value_in.value.str = strVal_s;
} else if (format == vpiHexStrVal) {
sprintf(strVal_s, "%0*" PRIx64, (spanSize + 3) / 4, intVal);
snprintf(strVal_s, MAX_SPANSIZE + 1, "%0*" PRIx64, (spanSize + 3) / 4, intVal);
value_in.value.str = strVal_s;
} else if (format == vpiOctStrVal) {
sprintf(strVal_s, "%0*" PRIo64, (spanSize + 2) / 3, intVal);
snprintf(strVal_s, MAX_SPANSIZE + 1, "%0*" PRIo64, (spanSize + 2) / 3, intVal);
value_in.value.str = strVal_s;
} else if (format == vpiStringVal) {
const int byteCount = (spanSize + 7) / 8;