diff options
author | Sergey Matveev <earthdok@google.com> | 2013-05-14 13:19:33 +0000 |
---|---|---|
committer | Sergey Matveev <earthdok@google.com> | 2013-05-14 13:19:33 +0000 |
commit | a615b26e3e3c2da0b2f950f506f6c2c220430c19 (patch) | |
tree | 90f794a857bf12db280233795542d9cbaae8df73 /lib/sanitizer_common | |
parent | 411e828bf174dab9cfe7b64a5081cb870b71a73a (diff) | |
download | compiler-rt-a615b26e3e3c2da0b2f950f506f6c2c220430c19.tar.gz |
[sanitizer] Minor fixes in sanitizer_common tests.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@181786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common')
5 files changed, 17 insertions, 12 deletions
diff --git a/lib/sanitizer_common/tests/sanitizer_common_test.cc b/lib/sanitizer_common/tests/sanitizer_common_test.cc index be752a596..424c279d4 100644 --- a/lib/sanitizer_common/tests/sanitizer_common_test.cc +++ b/lib/sanitizer_common/tests/sanitizer_common_test.cc @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "sanitizer_common/sanitizer_common.h" #include "sanitizer_common/sanitizer_libc.h" +#include "sanitizer_common/sanitizer_platform.h" #include "gtest/gtest.h" namespace __sanitizer { @@ -79,7 +80,7 @@ TEST(SanitizerCommon, MmapAlignedOrDie) { } } -#ifdef __linux__ +#if SANITIZER_LINUX TEST(SanitizerCommon, SanitizerSetThreadName) { const char *names[] = { "0123456789012", @@ -125,7 +126,7 @@ void TestThreadInfo(bool main) { EXPECT_GT((uptr)&stack_var, stk_addr); EXPECT_LT((uptr)&stack_var, stk_addr + stk_size); -#if defined(__linux__) && defined(__x86_64__) +#if SANITIZER_LINUX && defined(__x86_64__) static __thread int thread_var; EXPECT_NE(tls_addr, (uptr)0); EXPECT_NE(tls_size, (uptr)0); @@ -150,7 +151,7 @@ TEST(SanitizerCommon, ThreadStackTlsMain) { TestThreadInfo(true); } -TEST(Platform, ThreadStackTlsWorker) { +TEST(SanitizerCommon, ThreadStackTlsWorker) { InitTlsSize(); pthread_t t; pthread_create(&t, 0, WorkerThread, 0); diff --git a/lib/sanitizer_common/tests/sanitizer_libc_test.cc b/lib/sanitizer_common/tests/sanitizer_libc_test.cc index cbef7bcef..39c29d357 100644 --- a/lib/sanitizer_common/tests/sanitizer_libc_test.cc +++ b/lib/sanitizer_common/tests/sanitizer_libc_test.cc @@ -11,9 +11,10 @@ #include "sanitizer_common/sanitizer_common.h" #include "sanitizer_common/sanitizer_libc.h" +#include "sanitizer_common/sanitizer_platform.h" #include "gtest/gtest.h" -#if defined(__linux__) || defined(__APPLE__) +#if SANITIZER_LINUX || SANITIZER_MAC # define SANITIZER_TEST_HAS_STAT_H 1 # include <sys/stat.h> #else @@ -62,7 +63,7 @@ TEST(SanitizerCommon, FileOps) { u32 uid = GetUid(); char temp_filename[128]; -#ifdef __ANDROID__ +#if SANITIZER_ANDROID // I don't know a way to query temp directory location on Android without // going through Java interfaces. The code below is not ideal, but should // work. May require "adb root", but it is needed for almost any use of ASan diff --git a/lib/sanitizer_common/tests/sanitizer_linux_test.cc b/lib/sanitizer_common/tests/sanitizer_linux_test.cc index 9a3f9270d..4c1ba19da 100644 --- a/lib/sanitizer_common/tests/sanitizer_linux_test.cc +++ b/lib/sanitizer_common/tests/sanitizer_linux_test.cc @@ -11,12 +11,13 @@ // //===----------------------------------------------------------------------===// -#ifdef __linux__ +#include "sanitizer_common/sanitizer_platform.h" +#if SANITIZER_LINUX #include "sanitizer_common/sanitizer_linux.h" -#include "gtest/gtest.h" #include "sanitizer_common/sanitizer_common.h" +#include "gtest/gtest.h" #ifdef __x86_64__ #include <asm/prctl.h> @@ -225,4 +226,4 @@ TEST(SanitizerLinux, ThreadDescriptorSize) { } // namespace __sanitizer -#endif // __linux__ +#endif // SANITIZER_LINUX diff --git a/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc b/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc index 29cbc9af4..a5f8516df 100644 --- a/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc +++ b/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc @@ -11,7 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifdef __linux__ +#include "sanitizer_common/sanitizer_platform.h" +#if SANITIZER_LINUX #include "sanitizer_common/sanitizer_stoptheworld.h" #include "gtest/gtest.h" @@ -190,4 +191,4 @@ TEST(StopTheWorld, SuspendThreadsAdvanced) { } // namespace __sanitizer -#endif // __linux__ +#endif // SANITIZER_LINUX diff --git a/lib/sanitizer_common/tests/sanitizer_stoptheworld_testlib.cc b/lib/sanitizer_common/tests/sanitizer_stoptheworld_testlib.cc index 74749d496..d8be2afb1 100644 --- a/lib/sanitizer_common/tests/sanitizer_stoptheworld_testlib.cc +++ b/lib/sanitizer_common/tests/sanitizer_stoptheworld_testlib.cc @@ -16,7 +16,8 @@ clang++ -fno-exceptions -g -fPIC -I. \ LD_PRELOAD=`pwd`/teststoptheworld.so /your/app */ -#ifdef __linux__ +#include "sanitizer_common/sanitizer_platform.h" +#if SANITIZER_LINUX #include <dlfcn.h> #include <stddef.h> @@ -49,4 +50,4 @@ __attribute__((constructor)) void StopTheWorldTestLibConstructor(void) { } } // namespace -#endif // __linux__ +#endif // SANITIZER_LINUX |