[compiler-rt] r181786 - [sanitizer] Minor fixes in sanitizer_common tests.
Sergey Matveev
earthdok at google.com
Tue May 14 06:19:34 PDT 2013
Author: smatveev
Date: Tue May 14 08:19:33 2013
New Revision: 181786
URL: http://llvm.org/viewvc/llvm-project?rev=181786&view=rev
Log:
[sanitizer] Minor fixes in sanitizer_common tests.
Modified:
compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_common_test.cc
compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc
compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_linux_test.cc
compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc
compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_stoptheworld_testlib.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_common_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_common_test.cc?rev=181786&r1=181785&r2=181786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_common_test.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_common_test.cc Tue May 14 08:19:33 2013
@@ -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);
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc?rev=181786&r1=181785&r2=181786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc Tue May 14 08:19:33 2013
@@ -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
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_linux_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_linux_test.cc?rev=181786&r1=181785&r2=181786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_linux_test.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_linux_test.cc Tue May 14 08:19:33 2013
@@ -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, ThreadDescriptorSiz
} // namespace __sanitizer
-#endif // __linux__
+#endif // SANITIZER_LINUX
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc?rev=181786&r1=181785&r2=181786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_stoptheworld_test.cc Tue May 14 08:19:33 2013
@@ -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, SuspendThreadsAdvance
} // namespace __sanitizer
-#endif // __linux__
+#endif // SANITIZER_LINUX
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_stoptheworld_testlib.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_stoptheworld_testlib.cc?rev=181786&r1=181785&r2=181786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_stoptheworld_testlib.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_stoptheworld_testlib.cc Tue May 14 08:19:33 2013
@@ -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 StopTh
}
} // namespace
-#endif // __linux__
+#endif // SANITIZER_LINUX
More information about the llvm-commits
mailing list