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