scons: Use the lsan-suppressions file when running internal commands.
authorGabe Black <gabe.black@gmail.com>
Thu, 26 Mar 2020 10:20:41 +0000 (03:20 -0700)
committerGabe Black <gabeblack@google.com>
Fri, 27 Mar 2020 08:44:28 +0000 (08:44 +0000)
These commands (like the marshal binary) might otherwise fail with
spurious leaks detected in the python library.

Change-Id: I042c2a811d465ac03f005672f328c0fb0b594494
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27125
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
SConstruct

index b93a000266782bfb5d08006c85d84f91112eb853..4273d147ff162965517a12cf0a7e5c48d59c4519 100755 (executable)
@@ -510,6 +510,16 @@ if GetOption('with_asan'):
     # Available for gcc >= 4.8 or llvm >= 3.1 both a requirement
     # by the build system
     sanitizers.append('address')
+    suppressions_file = Dir('util').File('lsan-suppressions').get_abspath()
+    suppressions_opt = 'suppressions=%s' % suppressions_file
+    main['ENV']['LSAN_OPTIONS'] = ':'.join([suppressions_opt,
+                                            'print_suppressions=0'])
+    print()
+    warning('To suppress false positive leaks, set the LSAN_OPTIONS '
+            'environment variable to "%s" when running gem5' %
+            suppressions_opt)
+    warning('LSAN_OPTIONS=suppressions=%s' % suppressions_opt)
+    print()
 if sanitizers:
     sanitizers = ','.join(sanitizers)
     if main['GCC'] or main['CLANG']: