summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-11-24 19:20:05 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-11-24 19:20:05 +0000
commitf2ca4cb86df1d38c439f35774210b16f36841531 (patch)
tree1e34e5b1f175a61d12fc3664b0aa889717c8dc00 /unittests
parentbf8209daf875fa533a379290a91d01be5152597d (diff)
downloadllvm-f2ca4cb86df1d38c439f35774210b16f36841531.tar.gz
llvm-f2ca4cb86df1d38c439f35774210b16f36841531.tar.bz2
llvm-f2ca4cb86df1d38c439f35774210b16f36841531.tar.xz
unittests: Add SystemTests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120101 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/CMakeLists.txt14
-rw-r--r--unittests/Makefile2
-rw-r--r--unittests/Support/System.cpp16
-rw-r--r--unittests/System/Makefile15
-rw-r--r--unittests/System/Path.cpp18
-rw-r--r--unittests/System/TimeValue.cpp23
6 files changed, 70 insertions, 18 deletions
diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt
index 76b76f2b88..41e20cfc90 100644
--- a/unittests/CMakeLists.txt
+++ b/unittests/CMakeLists.txt
@@ -17,6 +17,9 @@ add_custom_target(UnitTests)
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_LINK_COMPONENTS
set(LLVM_USED_LIBS
gtest
gtest_main
+ LLVMSupport # gtest needs it for raw_ostream.
)
add_llvm_unittest(ADT
@@ -117,7 +121,15 @@ add_llvm_unittest(Support
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
+ )
diff --git a/unittests/Makefile b/unittests/Makefile
index 0401cd1c67..71ba552326 100644
--- a/unittests/Makefile
+++ b/unittests/Makefile
@@ -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
diff --git a/unittests/Support/System.cpp b/unittests/Support/System.cpp
deleted file mode 100644
index 5fa7b39183..0000000000
--- a/unittests/Support/System.cpp
+++ /dev/null
@@ -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);
-}
-}
diff --git a/unittests/System/Makefile b/unittests/System/Makefile
new file mode 100644
index 0000000000..336ac30383
--- /dev/null
+++ b/unittests/System/Makefile
@@ -0,0 +1,15 @@
+##===- unittests/System/Makefile ---------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../..
+TESTNAME = System
+LINK_COMPONENTS := system
+
+include $(LEVEL)/Makefile.config
+include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
diff --git a/unittests/System/Path.cpp b/unittests/System/Path.cpp
new file mode 100644
index 0000000000..85fbb6124b
--- /dev/null
+++ b/unittests/System/Path.cpp
@@ -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
diff --git a/unittests/System/TimeValue.cpp b/unittests/System/TimeValue.cpp
new file mode 100644
index 0000000000..d1da5c14ee
--- /dev/null
+++ b/unittests/System/TimeValue.cpp
@@ -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);
+}
+
+}