1de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov//===-- asan_test_main.cc -------------------------------------------------===//
2de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov//
3de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov//                     The LLVM Compiler Infrastructure
4de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov//
5de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov// This file is distributed under the University of Illinois Open Source
6de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov// License. See LICENSE.TXT for details.
7de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov//
8de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov//===----------------------------------------------------------------------===//
9de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov//
10de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov// This file is a part of AddressSanitizer, an address sanity checker.
11de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov//
12de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov//===----------------------------------------------------------------------===//
13de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov#include "asan_test_utils.h"
143d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar#include "sanitizer_common/sanitizer_platform.h"
153d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar
163d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar// Default ASAN_OPTIONS for the unit tests. Let's turn symbolication off to
173d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar// speed up testing (unit tests don't use it anyway).
183d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainarextern "C" const char* __asan_default_options() {
193d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar#if SANITIZER_MAC
203d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar  // On Darwin, we default to `abort_on_error=1`, which would make tests run
213d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar  // much slower. Let's override this and run lit tests with 'abort_on_error=0'.
223d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar  // Also, make sure we do not overwhelm the syslog while testing.
233d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar  return "symbolize=false:abort_on_error=0:log_to_syslog=0";
243d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar#else
253d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar  return "symbolize=false";
263d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar#endif
273d763c0d3700e73b3aead8e65e04ec28efc56138Pirama Arumuga Nainar}
28de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov
29de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonovint main(int argc, char **argv) {
30de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov  testing::GTEST_FLAG(death_test_style) = "threadsafe";
31de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov  testing::InitGoogleTest(&argc, argv);
32de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov  return RUN_ALL_TESTS();
33de55be3899b994731ba2d9e168281d608dab3048Alexey Samsonov}
34