Skip to content

Commit

Permalink
Add flag to source sanitizer suppressions
Browse files Browse the repository at this point in the history
  • Loading branch information
bdero committed Aug 16, 2021
1 parent c0f2911 commit b91aa13
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions testing/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ def main():
help='Generate coverage reports for each unit test framework run.')
parser.add_argument('--engine-capture-core-dump', dest='engine_capture_core_dump', action='store_true',
default=False, help='Capture core dumps from crashes of engine tests.')
parser.add_argument('--asan-options', dest='asan_options', action='store', type=str, default='',
help='Runtime AddressSanitizer flags to use if built wth asan (example: "verbosity=1:detect_leaks=0')
parser.add_argument('--use-sanitizer-suppressions', dest='sanitizer_suppressions', action='store_true',
default=False, help='Provide the sanitizer suppressions lists to the via environment to the tests.')

args = parser.parse_args()

Expand All @@ -559,8 +559,17 @@ def main():
if args.type != 'java':
assert os.path.exists(build_dir), 'Build variant directory %s does not exist!' % build_dir

if args.asan_options:
os.environ['ASAN_OPTIONS'] = args.asan_options
if args.sanitizer_suppressions:
file_dir = os.path.dirname(os.path.abspath(__file__))
command = [
"env", "-i", "bash",
"-c", f"source {file_dir}/sanitizer_suppressions.sh >/dev/null && env"
]
process = subprocess.Popen(command, stdout=subprocess.PIPE)
for line in process.stdout:
key, _, value = str(line).partition("=")
os.environ[key] = value
process.communicate() # Avoid pipe deadlock while waiting for termination.

engine_filter = args.engine_filter.split(',') if args.engine_filter else None
if 'engine' in types:
Expand Down

0 comments on commit b91aa13

Please sign in to comment.