Mute failed tests when no sanitizer defects.
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 <yvesg@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25273}
diff --git a/test/test_main_lib.cc b/test/test_main_lib.cc
index e939f94..95144c9 100644
--- a/test/test_main_lib.cc
+++ b/test/test_main_lib.cc
@@ -148,6 +148,14 @@
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
}