From cb46dbb237800d48d1ecfb98a63746b6d3d56213 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Tue, 12 May 2020 09:03:59 +0000 Subject: [PATCH] [infra] Recognize the exit code for UBSAN failures. This seems to only affect the bots and not local runs of test.py. Bug: https://github.com/dart-lang/sdk/issues/39427 Change-Id: I3d80fc662a29585416a61f454b21f977853c0e71 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147621 Reviewed-by: William Hesse Commit-Queue: William Hesse --- pkg/test_runner/lib/src/command_output.dart | 2 ++ pkg/test_runner/lib/src/options.dart | 2 ++ tools/build.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/pkg/test_runner/lib/src/command_output.dart b/pkg/test_runner/lib/src/command_output.dart index 3c1eae43234..59b6ce25c50 100644 --- a/pkg/test_runner/lib/src/command_output.dart +++ b/pkg/test_runner/lib/src/command_output.dart @@ -696,6 +696,7 @@ class VMCommandOutput extends CommandOutput with _UnittestSuiteMessagesMixin { static const _compileErrorExitCode = 254; static const _uncaughtExceptionExitCode = 255; static const _adbInfraFailureCodes = [10]; + static const _ubsanFailureExitCode = 1; VMCommandOutput(Command command, int exitCode, bool timedOut, List stdout, List stderr, Duration time, int pid) @@ -751,6 +752,7 @@ class VMCommandOutput extends CommandOutput with _UnittestSuiteMessagesMixin { // The actual outcome depends on the exitCode. if (exitCode == _compileErrorExitCode) return Expectation.compileTimeError; if (exitCode == _uncaughtExceptionExitCode) return Expectation.runtimeError; + if (exitCode == _ubsanFailureExitCode) return Expectation.fail; if (exitCode != 0) { var ourExit = 5; // Unknown nonzero exit code from vm command. diff --git a/pkg/test_runner/lib/src/options.dart b/pkg/test_runner/lib/src/options.dart index 648bd24c5b1..be713c5eafa 100644 --- a/pkg/test_runner/lib/src/options.dart +++ b/pkg/test_runner/lib/src/options.dart @@ -1014,8 +1014,10 @@ final Map sanitizerEnvironmentVariables = (() { if (symbolizerPath != null) { symbolizerPath = path.join(Directory.current.path, symbolizerPath); environment['ASAN_SYMBOLIZER_PATH'] = symbolizerPath; + environment['LSAN_SYMBOLIZER_PATH'] = symbolizerPath; environment['MSAN_SYMBOLIZER_PATH'] = symbolizerPath; environment['TSAN_SYMBOLIZER_PATH'] = symbolizerPath; + environment['UBSAN_SYMBOLIZER_PATH'] = symbolizerPath; } return environment; diff --git a/tools/build.py b/tools/build.py index 0d05cd98ea0..895c698c52a 100755 --- a/tools/build.py +++ b/tools/build.py @@ -351,8 +351,10 @@ def SanitizerEnvironmentVariables(): if symbolizer_path: symbolizer_path = str(os.path.join(DART_ROOT, symbolizer_path)) env['ASAN_SYMBOLIZER_PATH'] = symbolizer_path + env['LSAN_SYMBOLIZER_PATH'] = symbolizer_path env['MSAN_SYMBOLIZER_PATH'] = symbolizer_path env['TSAN_SYMBOLIZER_PATH'] = symbolizer_path + env['UBSAN_SYMBOLIZER_PATH'] = symbolizer_path return env