Skip to content

Commit e9bf299

Browse files
authored
Use the suppressions script to source runtime suppressions in run_tests.py (flutter#28140)
1 parent 2b0ef0a commit e9bf299

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

testing/run_tests.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,8 @@ def main():
545545
help='Generate coverage reports for each unit test framework run.')
546546
parser.add_argument('--engine-capture-core-dump', dest='engine_capture_core_dump', action='store_true',
547547
default=False, help='Capture core dumps from crashes of engine tests.')
548-
parser.add_argument('--asan-options', dest='asan_options', action='store', type=str, default='',
549-
help='Runtime AddressSanitizer flags to use if built wth asan (example: "verbosity=1:detect_leaks=0')
548+
parser.add_argument('--use-sanitizer-suppressions', dest='sanitizer_suppressions', action='store_true',
549+
default=False, help='Provide the sanitizer suppressions lists to the via environment to the tests.')
550550

551551
args = parser.parse_args()
552552

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

562-
if args.asan_options:
563-
os.environ['ASAN_OPTIONS'] = args.asan_options
562+
if args.sanitizer_suppressions:
563+
file_dir = os.path.dirname(os.path.abspath(__file__))
564+
command = [
565+
"env", "-i", "bash",
566+
"-c", "source {}/sanitizer_suppressions.sh >/dev/null && env".format(file_dir)
567+
]
568+
process = subprocess.Popen(command, stdout=subprocess.PIPE)
569+
for line in process.stdout:
570+
key, _, value = str(line).partition("=")
571+
os.environ[key] = value
572+
process.communicate() # Avoid pipe deadlock while waiting for termination.
564573

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

testing/sanitizer_suppressions.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
CURRENT_DIRECTORY="$(pwd)/$(dirname "$0")"
1+
TESTING_DIRECTORY=$(dirname "${BASH_SOURCE[0]}")
22

3-
TSAN_SUPPRESSIONS_FILE="${CURRENT_DIRECTORY}/tsan_suppressions.txt"
3+
TSAN_SUPPRESSIONS_FILE="${TESTING_DIRECTORY}/tsan_suppressions.txt"
44
export TSAN_OPTIONS="suppressions=${TSAN_SUPPRESSIONS_FILE}"
55
echo "Using Thread Sanitizer suppressions in ${TSAN_SUPPRESSIONS_FILE}"
66

7-
LSAN_SUPPRESSIONS_FILE="${CURRENT_DIRECTORY}/lsan_suppressions.txt"
7+
LSAN_SUPPRESSIONS_FILE="${TESTING_DIRECTORY}/lsan_suppressions.txt"
88
export LSAN_OPTIONS="suppressions=${LSAN_SUPPRESSIONS_FILE}"
99
echo "Using Leak Sanitizer suppressions in ${LSAN_SUPPRESSIONS_FILE}"
1010

11-
UBSAN_SUPPRESSIONS_FILE="${CURRENT_DIRECTORY}/ubsan_suppressions.txt"
11+
UBSAN_SUPPRESSIONS_FILE="${TESTING_DIRECTORY}/ubsan_suppressions.txt"
1212
export UBSAN_OPTIONS="suppressions=${UBSAN_SUPPRESSIONS_FILE}"
1313
echo "Using Undefined Behavior suppressions in ${UBSAN_SUPPRESSIONS_FILE}"
1414

1515

16-
export ASAN_OPTIONS="detect_leaks=1"
16+
export ASAN_OPTIONS="detect_leaks=0:detect_container_overflow=0"

0 commit comments

Comments
 (0)