1//===-- asan_test_main.cpp ------------------------------------------------===//
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// This file is a part of AddressSanitizer, an address sanity checker.
10//
11//===----------------------------------------------------------------------===//
12#include "asan_test_utils.h"
13#include "sanitizer_common/sanitizer_platform.h"
14
15// Default ASAN_OPTIONS for the unit tests.
16extern "C" const char* __asan_default_options() {
17#if SANITIZER_APPLE
18 // On Darwin, we default to `abort_on_error=1`, which would make tests run
19 // much slower. Let's override this and run lit tests with 'abort_on_error=0'
20 // and make sure we do not overwhelm the syslog while testing. Also, let's
21 // turn symbolization off to speed up testing, especially when not running
22 // with llvm-symbolizer but with atos.
23 return "symbolize=false:abort_on_error=0:log_to_syslog=0";
24#elif SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT
25 // On PowerPC and ARM Thumb, a couple tests involving pthread_exit fail due to
26 // leaks detected by LSan. Symbolized leak report is required to apply a
27 // suppression for this known problem.
28 return "";
29#else
30 // Let's turn symbolization off to speed up testing (more than 3 times speedup
31 // observed).
32 return "symbolize=false";
33#endif
34}
35
36int main(int argc, char **argv) {
37 testing::GTEST_FLAG(death_test_style) = "threadsafe";
38 testing::InitGoogleTest(&argc, argv);
39 return RUN_ALL_TESTS();
40}
41

source code of compiler-rt/lib/asan/tests/asan_test_main.cpp