about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2014-09-13 18:52:30 -0700
committerDaniel Dunbar <daniel@zuster.org>2014-09-13 18:52:30 -0700
commit3369faf382a6a18e29ef871fdd9bd9da5445af8c (patch)
treef239c1fc85a1a9656b0a0d33ed9901c8a861d4b2
parentc6555deaca41515a5d9c87fec6718ffacd650bf5 (diff)
downloadklee-3369faf382a6a18e29ef871fdd9bd9da5445af8c.tar.gz
[tests] Add support for testing LLVM version in REQUIRES: and XFAIL: lines.
 - You can now make tests disabled, or expected to fail, by writing something like:

     // XFAIL: llvm-3.4

   or

     // REQUIRES: not-llvm-3.4

 - This mechanism doesn't support version comparisons, it is mostly intended to
   help with switching over to new LLVM versions and incrementally working
   through the test failures.
-rw-r--r--test/Makefile1
-rw-r--r--test/lit.cfg11
-rw-r--r--test/lit.site.cfg.in1
3 files changed, 13 insertions, 0 deletions
diff --git a/test/Makefile b/test/Makefile
index 6be82442..31896075 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -76,6 +76,7 @@ lit.site.cfg: lit.site.cfg.in
 	     -e "s#@KLEE_TOOLS_DIR@#$(ToolDir)#g" \
 	     -e "s#@LLVM_TOOLS_DIR@#$(LLVMToolDir)#g" \
 	     -e "s#@LLVM_VERSION_MAJOR@#$(LLVM_VERSION_MAJOR)#g" \
+	     -e "s#@LLVM_VERSION_MINOR@#$(LLVM_VERSION_MINOR)#g" \
 	     -e "s#@LLVMCC@#$(KLEE_BITCODE_C_COMPILER) -I$(PROJ_SRC_ROOT)/include#g" \
 	     -e "s#@LLVMCXX@#$(KLEE_BITCODE_CXX_COMPILER) -I$(PROJ_SRC_ROOT)/include#g" \
 	     -e "s#@ENABLE_UCLIBC@#$(ENABLE_UCLIBC)#g" \
diff --git a/test/lit.cfg b/test/lit.cfg
index a2c9813a..ccd3b57e 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -105,3 +105,14 @@ for s,basename,extra_args in subs:
 if int(config.llvm_version_major) == 2:
     # This is a hack
     config.substitutions.append(('%T','Output'))
+
+# Add feature for the LLVM version in use, so it can be tested in REQUIRES and
+# XFAIL checks. We also add "not-XXX" variants, for the same reason.
+known_llvm_versions = set(["2.9", "3.4", "3.5"])
+current_llvm_version = "%s.%s" % (config.llvm_version_major,
+                                  config.llvm_version_minor)
+config.available_features.add("llvm-" + current_llvm_version)
+for version in known_llvm_versions:
+   if version != current_llvm_version:
+      config.available_features.add("not-llvm-" + version)
+                          
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 14ba94e6..8e2d79a4 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -7,6 +7,7 @@ config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
 
 # Needed to check if a hack needs to be applied
 config.llvm_version_major = "@LLVM_VERSION_MAJOR@"
+config.llvm_version_minor = "@LLVM_VERSION_MINOR@"
 
 # Compilers
 # FIXME: use llvmcc not llvmgcc