[msan] Move test main and gtest include to separate files.

llvm-svn: 177718
This commit is contained in:
Evgeniy Stepanov 2013-03-22 09:01:26 +00:00
parent 55e63ef454
commit 93a842bd1f
4 changed files with 51 additions and 10 deletions

View File

@ -31,9 +31,10 @@ set(MSAN_LIBCXX_LINK_FLAGS
-fsanitize=memory)
# Unittest sources and build flags.
set(MSAN_UNITTEST_SOURCE msan_test.cc)
set(MSAN_UNITTEST_SOURCES msan_test.cc msan_test_main.cc)
set(MSAN_LOADABLE_SOURCE msan_loadable.cc)
set(MSAN_UNITTEST_HEADERS
msan_test_config.h
msandr_test_so.h
../../../include/sanitizer/msan_interface.h
)
@ -133,8 +134,10 @@ macro(add_msan_tests_for_arch arch)
# Instrumented tests.
set(MSAN_INST_TEST_OBJECTS)
msan_compile(MSAN_INST_TEST_OBJECTS ${MSAN_UNITTEST_SOURCE} ${arch}
${MSAN_UNITTEST_INSTRUMENTED_CFLAGS})
foreach (SOURCE ${MSAN_UNITTEST_SOURCES})
msan_compile(MSAN_INST_TEST_OBJECTS ${SOURCE} ${arch}
${MSAN_UNITTEST_INSTRUMENTED_CFLAGS})
endforeach(SOURCE)
# Instrumented loadable module objects.
set(MSAN_INST_LOADABLE_OBJECTS)

View File

@ -12,9 +12,12 @@
// MemorySanitizer unit tests.
//===----------------------------------------------------------------------===//
#ifndef MSAN_EXTERNAL_TEST_CONFIG
#include "msan_test_config.h"
#endif // MSAN_EXTERNAL_TEST_CONFIG
#include "sanitizer/msan_interface.h"
#include "msandr_test_so.h"
#include "gtest/gtest.h"
#include <stdlib.h>
#include <stdarg.h>
@ -1943,9 +1946,3 @@ TEST(MemorySanitizer, CallocOverflow) {
TEST(MemorySanitizerStress, DISABLED_MallocStackTrace) {
RecursiveMalloc(22);
}
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
int res = RUN_ALL_TESTS();
return res;
}

View File

@ -0,0 +1,20 @@
//===-- msan_test_config.h ----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of MemorySanitizer.
//
// MemorySanitizer unit tests.
//===----------------------------------------------------------------------===//
#ifndef MSAN_TEST_CONFIG_H
#define MSAN_TEST_CONFIG_H
#include "gtest/gtest.h"
#endif // MSAN_TEST_CONFIG_H

View File

@ -0,0 +1,21 @@
//===-- msan_test_main.cc -------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of MemorySanitizer.
//
//===----------------------------------------------------------------------===//
#ifndef MSAN_EXTERNAL_TEST_CONFIG
#include "msan_test_config.h"
#endif // MSAN_EXTERNAL_TEST_CONFIG
int main(int argc, char **argv) {
testing::GTEST_FLAG(death_test_style) = "threadsafe";
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}