summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-02-14 11:00:07 +0000
committerAlexey Samsonov <samsonov@google.com>2014-02-14 11:00:07 +0000
commite1c4400a92b57ecf62abb892da2a8a0a3be43600 (patch)
treeb454fe437d46bd919e9eb7bce2bc32ea957015ae /unittests
parentea9eb19ec0fea9d387bfe41bb187efd4a1a52fd5 (diff)
Move shared configs for lit test suites to test/ and unittests/ directories
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201399 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/CMakeLists.txt3
-rw-r--r--unittests/lit.common.unit.cfg30
-rw-r--r--unittests/lit.common.unit.configured.in24
3 files changed, 57 insertions, 0 deletions
diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt
new file mode 100644
index 000000000..fe2c39781
--- /dev/null
+++ b/unittests/CMakeLists.txt
@@ -0,0 +1,3 @@
+configure_lit_site_cfg(
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.common.unit.configured.in
+ ${CMAKE_CURRENT_BINARY_DIR}/lit.common.unit.configured)
diff --git a/unittests/lit.common.unit.cfg b/unittests/lit.common.unit.cfg
new file mode 100644
index 000000000..2bd8f376f
--- /dev/null
+++ b/unittests/lit.common.unit.cfg
@@ -0,0 +1,30 @@
+# -*- Python -*-
+
+# Configuration file for 'lit' test runner.
+# This file contains common config setup rules for unit tests in various
+# compiler-rt testsuites.
+
+import os
+
+import lit.formats
+
+# Setup test format
+llvm_build_mode = getattr(config, "llvm_build_mode", "Debug")
+config.test_format = lit.formats.GoogleTest(llvm_build_mode, "Test")
+
+# Setup test suffixes.
+config.suffixes = []
+
+# Tweak PATH to include llvm tools dir.
+llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
+if (not llvm_tools_dir) or (not os.path.exists(llvm_tools_dir)):
+ lit_config.fatal("Invalid llvm_tools_dir config attribute: %r" % llvm_tools_dir)
+path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
+config.environment['PATH'] = path
+
+# Propagate the temp directory. Windows requires this because it uses \Windows\
+# if none of these are present.
+if 'TMP' in os.environ:
+ config.environment['TMP'] = os.environ['TMP']
+if 'TEMP' in os.environ:
+ config.environment['TEMP'] = os.environ['TEMP']
diff --git a/unittests/lit.common.unit.configured.in b/unittests/lit.common.unit.configured.in
new file mode 100644
index 000000000..fe827c638
--- /dev/null
+++ b/unittests/lit.common.unit.configured.in
@@ -0,0 +1,24 @@
+## Autogenerated by LLVM/Clang configuration.
+# Do not edit!
+
+# Generic config options for all compiler-rt unit tests.
+config.target_triple = "@TARGET_TRIPLE@"
+config.llvm_src_root = "@LLVM_SOURCE_DIR@"
+config.llvm_obj_root = "@LLVM_BINARY_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
+config.llvm_build_mode = "@LLVM_BUILD_MODE@"
+config.host_arch = "@HOST_ARCH@"
+config.host_os = "@HOST_OS@"
+
+# LLVM tools dir and build mode can be passed in lit parameters,
+# so try to apply substitution.
+try:
+ config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
+ config.llvm_build_mode = config.llvm_build_mode % lit_config.params
+except KeyError,e:
+ key, = e.args
+ lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
+
+# Setup attributes common for all compiler-rt unit tests.
+lit_config.load_config(config, "@COMPILER_RT_SOURCE_DIR@/unittests/lit.common.unit.cfg")