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