From 53347b7d667b76141acafef2b9abffb314be30b1 Mon Sep 17 00:00:00 2001 From: Yves Gerey Date: Fri, 19 Oct 2018 15:04:04 +0200 Subject: [PATCH] Mute failed tests when no sanitizer defects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want sanitizer bots to show failure only for sanitizer defects. To do so, this CL forces exit code to 0 unconditionally. Sanitized binaries will turn it to 66 if there is any defect with diagnostic. Bug: webrtc:9849 Change-Id: I46b683dcae12b76f1be177603af59e3f34bff3a9 Reviewed-on: https://webrtc-review.googlesource.com/c/107060 Commit-Queue: Yves Gerey Reviewed-by: Patrik Höglund Cr-Commit-Position: refs/heads/master@{#25273} --- rtc_base/unittest_main.cc | 8 ++++++++ test/test_main_lib.cc | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/rtc_base/unittest_main.cc b/rtc_base/unittest_main.cc index 73ec44ad68..28a1bbbc09 100644 --- a/rtc_base/unittest_main.cc +++ b/rtc_base/unittest_main.cc @@ -137,5 +137,13 @@ int main(int argc, char* argv[]) { _CrtSetReportHook2(_CRT_RPTHOOK_REMOVE, TestCrtReportHandler); #endif +#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) || \ + defined(MEMORY_SANITIZER) || defined(THREAD_SANITIZER) || \ + defined(UNDEFINED_SANITIZER) + // We want the test flagged as failed only for sanitizer defects, + // in which case the sanitizer will override exit code with 66. + return 0; +#endif + return res; } diff --git a/test/test_main_lib.cc b/test/test_main_lib.cc index e939f94af0..95144c98fc 100644 --- a/test/test_main_lib.cc +++ b/test/test_main_lib.cc @@ -148,6 +148,14 @@ class TestMainImpl : public TestMain { result_file.close(); } +#if defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER) || \ + defined(MEMORY_SANITIZER) || defined(THREAD_SANITIZER) || \ + defined(UNDEFINED_SANITIZER) + // We want the test flagged as failed only for sanitizer defects, + // in which case the sanitizer will override exit code with 66. + return 0; +#endif + return exit_code; #endif }