13cab2bb3Spatrick //===-- asan_test_main.cpp ------------------------------------------------===//
23cab2bb3Spatrick //
33cab2bb3Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
43cab2bb3Spatrick // See https://llvm.org/LICENSE.txt for license information.
53cab2bb3Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
63cab2bb3Spatrick //
73cab2bb3Spatrick //===----------------------------------------------------------------------===//
83cab2bb3Spatrick //
93cab2bb3Spatrick // This file is a part of AddressSanitizer, an address sanity checker.
103cab2bb3Spatrick //
113cab2bb3Spatrick //===----------------------------------------------------------------------===//
123cab2bb3Spatrick #include "asan_test_utils.h"
133cab2bb3Spatrick #include "sanitizer_common/sanitizer_platform.h"
143cab2bb3Spatrick
153cab2bb3Spatrick // Default ASAN_OPTIONS for the unit tests.
__asan_default_options()163cab2bb3Spatrick extern "C" const char* __asan_default_options() {
17*810390e3Srobert #if SANITIZER_APPLE
183cab2bb3Spatrick // On Darwin, we default to `abort_on_error=1`, which would make tests run
193cab2bb3Spatrick // much slower. Let's override this and run lit tests with 'abort_on_error=0'
203cab2bb3Spatrick // and make sure we do not overwhelm the syslog while testing. Also, let's
213cab2bb3Spatrick // turn symbolization off to speed up testing, especially when not running
223cab2bb3Spatrick // with llvm-symbolizer but with atos.
233cab2bb3Spatrick return "symbolize=false:abort_on_error=0:log_to_syslog=0";
243cab2bb3Spatrick #elif SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT
253cab2bb3Spatrick // On PowerPC and ARM Thumb, a couple tests involving pthread_exit fail due to
263cab2bb3Spatrick // leaks detected by LSan. Symbolized leak report is required to apply a
273cab2bb3Spatrick // suppression for this known problem.
283cab2bb3Spatrick return "";
293cab2bb3Spatrick #else
303cab2bb3Spatrick // Let's turn symbolization off to speed up testing (more than 3 times speedup
313cab2bb3Spatrick // observed).
323cab2bb3Spatrick return "symbolize=false";
333cab2bb3Spatrick #endif
343cab2bb3Spatrick }
353cab2bb3Spatrick
main(int argc,char ** argv)363cab2bb3Spatrick int main(int argc, char **argv) {
373cab2bb3Spatrick testing::GTEST_FLAG(death_test_style) = "threadsafe";
383cab2bb3Spatrick testing::InitGoogleTest(&argc, argv);
393cab2bb3Spatrick return RUN_ALL_TESTS();
403cab2bb3Spatrick }
41