1 //===-- asan_test_main.cc -------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of AddressSanitizer, an address sanity checker.
12 //===----------------------------------------------------------------------===//
13 #include "asan_test_utils.h"
14 #include "sanitizer_common/sanitizer_platform.h"
16 // Default ASAN_OPTIONS for the unit tests.
17 extern "C" const char* __asan_default_options() {
19 // On Darwin, we default to `abort_on_error=1`, which would make tests run
20 // much slower. Let's override this and run lit tests with 'abort_on_error=0'
21 // and make sure we do not overwhelm the syslog while testing. Also, let's
22 // turn symbolization off to speed up testing, especially when not running
23 // with llvm-symbolizer but with atos.
24 return "symbolize=false:abort_on_error=0:log_to_syslog=0";
25 #elif SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT
26 // On PowerPC and ARM Thumb, a couple tests involving pthread_exit fail due to
27 // leaks detected by LSan. Symbolized leak report is required to apply a
28 // suppression for this known problem.
31 // Let's turn symbolization off to speed up testing (more than 3 times speedup
33 return "symbolize=false";
37 namespace __sanitizer {
38 bool ReexecDisabled() {
39 #if __has_feature(address_sanitizer) && SANITIZER_MAC
40 // Allow re-exec in instrumented unit tests on Darwin. Technically, we only
41 // need this for 10.10 and below, where re-exec is required for the
42 // interceptors to work, but to avoid duplicating the version detection logic,
43 // let's just allow re-exec for all Darwin versions. On newer OS versions,
44 // returning 'false' doesn't do anything anyway, because we don't re-exec.
50 } // namespace __sanitizer
52 int main(int argc, char **argv) {
53 testing::GTEST_FLAG(death_test_style) = "threadsafe";
54 testing::InitGoogleTest(&argc, argv);
55 return RUN_ALL_TESTS();