xref: /llvm-project/compiler-rt/lib/rtsan/tests/rtsan_test_main.cpp (revision 4bdac0851f4d613890558a8254043e21b0479b1e)
1 //===--- rtsan_test_main.cpp - Realtime Sanitizer ---------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #include "sanitizer_common/sanitizer_platform.h"
12 #include "sanitizer_test_utils.h"
13 
14 // Default RTSAN_OPTIONS for the unit tests.
15 extern "C" const char *__rtsan_default_options() {
16 #if SANITIZER_APPLE
17   // On Darwin, we default to `abort_on_error=1`, which would make tests run
18   // much slower. Let's override this and run lit tests with 'abort_on_error=0'
19   // and make sure we do not overwhelm the syslog while testing. Also, let's
20   // turn symbolization off to speed up testing, especially when not running
21   // with llvm-symbolizer but with atos.
22   return "symbolize=false:"
23          "abort_on_error=0:"
24          "log_to_syslog=0:"
25          "verify_interceptors=0:"; // some of our tests don't need interceptors
26 #else
27   // Let's turn symbolization off to speed up testing (more than 3 times speedup
28   // observed).
29   return "symbolize=false";
30 #endif
31 }
32 
33 int main(int argc, char **argv) {
34   testing::GTEST_FLAG(death_test_style) = "threadsafe";
35   testing::InitGoogleTest(&argc, argv);
36   return RUN_ALL_TESTS();
37 }
38