From 06263ec724e7bf1fb0a0366b3aec54cd431c51d6 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Sun, 22 Mar 2026 16:49:52 +0000 Subject: [PATCH] Tests: Set MallocNanoZone=0 on macOS when using asan --- test_regress/driver.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test_regress/driver.py b/test_regress/driver.py index 5b1d497e0..44156b8ab 100755 --- a/test_regress/driver.py +++ b/test_regress/driver.py @@ -696,6 +696,7 @@ class VlTest: self._scenario_off = False # scenarios() didn't match running scenario self._skips = None self._start_time = time.time() + self._uses_asan = False self._wall_time = 0 match = re.match(r'^(.*/)?([^/]*)\.py', self.py_filename) @@ -1127,6 +1128,9 @@ class VlTest: else: self.trace_format = 'vcd-c' # pylint: disable=attribute-defined-outside-init + if re.search(r'-runtime-debug', checkflags): + self._uses_asan = True + verilator_flags = [*param.get('verilator_flags', "")] if Args.gdb: verilator_flags += ["--gdb"] @@ -1853,6 +1857,10 @@ class VlTest: if entering: print("driver: Entering directory '" + os.path.abspath(entering) + "'") + if self._uses_asan and platform.system() == "Darwin": + # Otherwise asan prints warning that causes mismatch with expected output + os.environ['MallocNanoZone'] = '0' + # Execute command redirecting output, keeping order between stderr and stdout. # Must do low-level IO so GCC interaction works (can't be line-based) status = None @@ -3165,4 +3173,8 @@ if __name__ == '__main__': # Speed up single-test makes Args.driver_build_jobs_n = calc_jobs() + if Capabilities.have_dev_asan and platform.system() == "Darwin": + # Otherwise asan prints warning that causes mismatch with expected output + os.environ['MallocNanoZone'] = '0' + run_them()