[llvm-commits] [llvm] r120101 - in /llvm/trunk/unittests: CMakeLists.txt Makefile Support/System.cpp System/ System/Makefile System/Path.cpp System/TimeValue.cpp

Michael J. Spencer bigcheesegs at gmail.com
Wed Nov 24 11:20:05 PST 2010


Author: mspencer
Date: Wed Nov 24 13:20:05 2010
New Revision: 120101

URL: http://llvm.org/viewvc/llvm-project?rev=120101&view=rev
Log:
unittests: Add SystemTests.

Added:
    llvm/trunk/unittests/System/
    llvm/trunk/unittests/System/Makefile
      - copied, changed from r120099, llvm/trunk/unittests/Makefile
    llvm/trunk/unittests/System/Path.cpp
    llvm/trunk/unittests/System/TimeValue.cpp
Removed:
    llvm/trunk/unittests/Support/System.cpp
Modified:
    llvm/trunk/unittests/CMakeLists.txt
    llvm/trunk/unittests/Makefile

Modified: llvm/trunk/unittests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CMakeLists.txt?rev=120101&r1=120100&r2=120101&view=diff
==============================================================================
--- llvm/trunk/unittests/CMakeLists.txt (original)
+++ llvm/trunk/unittests/CMakeLists.txt Wed Nov 24 13:20:05 2010
@@ -17,6 +17,9 @@
 
 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
 add_definitions(-DGTEST_HAS_RTTI=0)
+if (NOT LLVM_ENABLE_THREADS)
+  add_definitions(-DGTEST_HAS_PTHREAD=0)
+endif()
 
 set(LLVM_LINK_COMPONENTS
   jit
@@ -33,6 +36,7 @@
 set(LLVM_USED_LIBS
   gtest
   gtest_main
+  LLVMSupport # gtest needs it for raw_ostream.
   )
 
 add_llvm_unittest(ADT
@@ -117,7 +121,15 @@
   Support/raw_ostream_test.cpp
   Support/RegexTest.cpp
   Support/SwapByteOrderTest.cpp
-  Support/System.cpp
   Support/TypeBuilderTest.cpp
   Support/ValueHandleTest.cpp
   )
+
+set(LLVM_LINK_COMPONENTS
+  System
+  )
+
+add_llvm_unittest(System
+  System/Path.cpp
+  System/TimeValue.cpp
+  )

Modified: llvm/trunk/unittests/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Makefile?rev=120101&r1=120100&r2=120101&view=diff
==============================================================================
--- llvm/trunk/unittests/Makefile (original)
+++ llvm/trunk/unittests/Makefile Wed Nov 24 13:20:05 2010
@@ -9,7 +9,7 @@
 
 LEVEL = ..
 
-PARALLEL_DIRS = ADT ExecutionEngine Support Transforms VMCore Analysis
+PARALLEL_DIRS = ADT ExecutionEngine Support System Transforms VMCore Analysis
 
 include $(LEVEL)/Makefile.common
 

Removed: llvm/trunk/unittests/Support/System.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/System.cpp?rev=120100&view=auto
==============================================================================
--- llvm/trunk/unittests/Support/System.cpp (original)
+++ llvm/trunk/unittests/Support/System.cpp (removed)
@@ -1,16 +0,0 @@
-//===- llvm/unittest/Support/System.cpp - System tests --===//
-#include "gtest/gtest.h"
-#include "llvm/System/TimeValue.h"
-#include <time.h>
-
-using namespace llvm;
-namespace {
-class SystemTest : public ::testing::Test {
-};
-
-TEST_F(SystemTest, TimeValue) {
-  sys::TimeValue now = sys::TimeValue::now();
-  time_t now_t = time(NULL);
-  EXPECT_TRUE(abs(static_cast<long>(now_t - now.toEpochTime())) < 2);
-}
-}

Copied: llvm/trunk/unittests/System/Makefile (from r120099, llvm/trunk/unittests/Makefile)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/System/Makefile?p2=llvm/trunk/unittests/System/Makefile&p1=llvm/trunk/unittests/Makefile&r1=120099&r2=120101&rev=120101&view=diff
==============================================================================
--- llvm/trunk/unittests/Makefile (original)
+++ llvm/trunk/unittests/System/Makefile Wed Nov 24 13:20:05 2010
@@ -1,4 +1,4 @@
-##===- unittests/Makefile ----------------------------------*- Makefile -*-===##
+##===- unittests/System/Makefile ---------------------------*- Makefile -*-===##
 #
 #                     The LLVM Compiler Infrastructure
 #
@@ -7,11 +7,9 @@
 #
 ##===----------------------------------------------------------------------===##
 
-LEVEL = ..
+LEVEL = ../..
+TESTNAME = System
+LINK_COMPONENTS := system
 
-PARALLEL_DIRS = ADT ExecutionEngine Support Transforms VMCore Analysis
-
-include $(LEVEL)/Makefile.common
-
-clean::
-	$(Verb) $(RM) -f *Tests
+include $(LEVEL)/Makefile.config
+include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest

Added: llvm/trunk/unittests/System/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/System/Path.cpp?rev=120101&view=auto
==============================================================================
--- llvm/trunk/unittests/System/Path.cpp (added)
+++ llvm/trunk/unittests/System/Path.cpp Wed Nov 24 13:20:05 2010
@@ -0,0 +1,18 @@
+//===- llvm/unittest/System/Path.cpp - Path tests -------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+
+namespace {
+
+TEST(System, Path) {
+  // TODO: Add tests!
+}
+
+} // anonymous namespace

Added: llvm/trunk/unittests/System/TimeValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/System/TimeValue.cpp?rev=120101&view=auto
==============================================================================
--- llvm/trunk/unittests/System/TimeValue.cpp (added)
+++ llvm/trunk/unittests/System/TimeValue.cpp Wed Nov 24 13:20:05 2010
@@ -0,0 +1,23 @@
+//===- llvm/unittest/System/TimeValue.cpp - Time Vlaue tests --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+#include "llvm/System/TimeValue.h"
+#include <time.h>
+
+using namespace llvm;
+namespace {
+
+TEST(System, TimeValue) {
+  sys::TimeValue now = sys::TimeValue::now();
+  time_t now_t = time(NULL);
+  EXPECT_TRUE(abs(static_cast<long>(now_t - now.toEpochTime())) < 2);
+}
+
+}





More information about the llvm-commits mailing list