[compiler-rt] r177718 - [msan] Move test main and gtest include to separate files.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Fri Mar 22 02:01:26 PDT 2013


Author: eugenis
Date: Fri Mar 22 04:01:26 2013
New Revision: 177718

URL: http://llvm.org/viewvc/llvm-project?rev=177718&view=rev
Log:
[msan] Move test main and gtest include to separate files.

Added:
    compiler-rt/trunk/lib/msan/tests/msan_test_config.h   (with props)
    compiler-rt/trunk/lib/msan/tests/msan_test_main.cc   (with props)
Modified:
    compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
    compiler-rt/trunk/lib/msan/tests/msan_test.cc

Modified: compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/CMakeLists.txt?rev=177718&r1=177717&r2=177718&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/msan/tests/CMakeLists.txt Fri Mar 22 04:01:26 2013
@@ -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)

Modified: compiler-rt/trunk/lib/msan/tests/msan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/msan_test.cc?rev=177718&r1=177717&r2=177718&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/msan_test.cc (original)
+++ compiler-rt/trunk/lib/msan/tests/msan_test.cc Fri Mar 22 04:01:26 2013
@@ -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;
-}

Added: compiler-rt/trunk/lib/msan/tests/msan_test_config.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/msan_test_config.h?rev=177718&view=auto
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/msan_test_config.h (added)
+++ compiler-rt/trunk/lib/msan/tests/msan_test_config.h Fri Mar 22 04:01:26 2013
@@ -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

Propchange: compiler-rt/trunk/lib/msan/tests/msan_test_config.h
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: compiler-rt/trunk/lib/msan/tests/msan_test_main.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/msan_test_main.cc?rev=177718&view=auto
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/msan_test_main.cc (added)
+++ compiler-rt/trunk/lib/msan/tests/msan_test_main.cc Fri Mar 22 04:01:26 2013
@@ -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();
+}

Propchange: compiler-rt/trunk/lib/msan/tests/msan_test_main.cc
------------------------------------------------------------------------------
    svn:eol-style = LF





More information about the llvm-commits mailing list