From bb11686888000e108a62611c168428a83d605649 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Mon, 23 Aug 2021 16:43:01 -0700 Subject: [PATCH] Symbolize ASan traces when using `run_tests.py` (flutter/engine#28274) * Configure ASan to symbolize on linux * Supply ASAN_SYMBOLIZER_PATH when running tests, fix problem with line stripping in run_tests --- engine/src/flutter/testing/run_tests.py | 2 +- .../src/flutter/testing/sanitizer_suppressions.sh | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/testing/run_tests.py b/engine/src/flutter/testing/run_tests.py index 414812a70c..2fab89d1d1 100755 --- a/engine/src/flutter/testing/run_tests.py +++ b/engine/src/flutter/testing/run_tests.py @@ -569,7 +569,7 @@ def main(): ] process = subprocess.Popen(command, stdout=subprocess.PIPE) for line in process.stdout: - key, _, value = str(line).partition("=") + key, _, value = line.decode('ascii').strip().partition("=") os.environ[key] = value process.communicate() # Avoid pipe deadlock while waiting for termination. diff --git a/engine/src/flutter/testing/sanitizer_suppressions.sh b/engine/src/flutter/testing/sanitizer_suppressions.sh index a6ce6802fa..7cb1e91791 100755 --- a/engine/src/flutter/testing/sanitizer_suppressions.sh +++ b/engine/src/flutter/testing/sanitizer_suppressions.sh @@ -1,4 +1,14 @@ -TESTING_DIRECTORY=$(dirname "${BASH_SOURCE[0]}") +TESTING_DIRECTORY=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd -P) +ENGINE_BUILDROOT=$(cd $TESTING_DIRECTORY/../..; pwd -P) + +case "$(uname -s)" in + Linux) + BUILDTOOLS_DIRECTORY="${ENGINE_BUILDROOT}/buildtools/linux-x64" + ;; + Darwin) + BUILDTOOLS_DIRECTORY="${ENGINE_BUILDROOT}/buildtools/mac-x64" + ;; +esac TSAN_SUPPRESSIONS_FILE="${TESTING_DIRECTORY}/tsan_suppressions.txt" export TSAN_OPTIONS="suppressions=${TSAN_SUPPRESSIONS_FILE}" @@ -13,4 +23,5 @@ export UBSAN_OPTIONS="suppressions=${UBSAN_SUPPRESSIONS_FILE}" echo "Using Undefined Behavior suppressions in ${UBSAN_SUPPRESSIONS_FILE}" -export ASAN_OPTIONS="detect_leaks=0:detect_container_overflow=0" +export ASAN_OPTIONS="symbolize=1:detect_leaks=0:detect_container_overflow=0" +export ASAN_SYMBOLIZER_PATH="${BUILDTOOLS_DIRECTORY}/clang/bin/llvm-symbolizer"