From c3f61d8eec6713bf805f3262c962a9d6c15ff3c4 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Fri, 28 Sep 2012 12:24:23 +0000 Subject: [PATCH] [ASan] Fix unit test headers. Add an option to change substitute asan_test_config.h file llvm-svn: 164821 --- compiler-rt/lib/asan/tests/asan_benchmarks_test.cc | 1 - compiler-rt/lib/asan/tests/asan_noinst_test.cc | 4 +--- compiler-rt/lib/asan/tests/asan_test.cc | 1 - compiler-rt/lib/asan/tests/asan_test_config.h | 6 +++++- compiler-rt/lib/asan/tests/asan_test_utils.h | 8 +++++++- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/compiler-rt/lib/asan/tests/asan_benchmarks_test.cc b/compiler-rt/lib/asan/tests/asan_benchmarks_test.cc index a142fd2..fc522de 100644 --- a/compiler-rt/lib/asan/tests/asan_benchmarks_test.cc +++ b/compiler-rt/lib/asan/tests/asan_benchmarks_test.cc @@ -12,7 +12,6 @@ // Some benchmarks for the instrumented code. //===----------------------------------------------------------------------===// -#include "asan_test_config.h" #include "asan_test_utils.h" template diff --git a/compiler-rt/lib/asan/tests/asan_noinst_test.cc b/compiler-rt/lib/asan/tests/asan_noinst_test.cc index 76ec387..037af9e 100644 --- a/compiler-rt/lib/asan/tests/asan_noinst_test.cc +++ b/compiler-rt/lib/asan/tests/asan_noinst_test.cc @@ -1,4 +1,4 @@ -//===-- asan_noinst_test.cc ----------------------===// +//===-- asan_noinst_test.cc -----------------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -17,7 +17,6 @@ #include "asan_mapping.h" #include "asan_stack.h" #include "asan_test_utils.h" -#include "asan_test_config.h" #include "sanitizer/asan_interface.h" #include @@ -26,7 +25,6 @@ #include // for memset() #include #include -#include "gtest/gtest.h" // Simple stand-alone pseudorandom number generator. // Current algorithm is ANSI C linear congruential PRNG. diff --git a/compiler-rt/lib/asan/tests/asan_test.cc b/compiler-rt/lib/asan/tests/asan_test.cc index f7642fb..be780a0 100644 --- a/compiler-rt/lib/asan/tests/asan_test.cc +++ b/compiler-rt/lib/asan/tests/asan_test.cc @@ -24,7 +24,6 @@ #include #endif -#include "asan_test_config.h" #include "asan_test_utils.h" #ifndef __APPLE__ diff --git a/compiler-rt/lib/asan/tests/asan_test_config.h b/compiler-rt/lib/asan/tests/asan_test_config.h index 6cf0e69..5e7501f 100644 --- a/compiler-rt/lib/asan/tests/asan_test_config.h +++ b/compiler-rt/lib/asan/tests/asan_test_config.h @@ -1,4 +1,4 @@ -//===-- asan_test_config.h ------------*- C++ -*-===// +//===-- asan_test_config.h --------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -10,6 +10,10 @@ // This file is a part of AddressSanitizer, an address sanity checker. // //===----------------------------------------------------------------------===// +#if !defined(INCLUDED_FROM_ASAN_TEST_UTILS_H) +# error "This file should be included into asan_test_utils.h only" +#endif + #ifndef ASAN_TEST_CONFIG_H #define ASAN_TEST_CONFIG_H diff --git a/compiler-rt/lib/asan/tests/asan_test_utils.h b/compiler-rt/lib/asan/tests/asan_test_utils.h index 7de1be4..b7805cd 100644 --- a/compiler-rt/lib/asan/tests/asan_test_utils.h +++ b/compiler-rt/lib/asan/tests/asan_test_utils.h @@ -1,4 +1,4 @@ -//===-- asan_test_utils.h ------------*- C++ -*-===// +//===-- asan_test_utils.h ---------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -14,6 +14,12 @@ #ifndef ASAN_TEST_UTILS_H #define ASAN_TEST_UTILS_H +#if !defined(ASAN_EXTERNAL_TEST_CONFIG) +# define INCLUDED_FROM_ASAN_TEST_UTILS_H +# include "asan_test_config.h" +# undef INCLUDED_FROM_ASAN_TEST_UTILS_H +#endif + #if defined(_WIN32) typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; -- 2.7.4