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}
This commit is contained in:
Yves Gerey 2018-10-19 15:04:04 +02:00 committed by Commit Bot
parent 2baa3c49b8
commit 53347b7d66
2 changed files with 16 additions and 0 deletions

View File

@ -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;
}

View File

@ -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
}