about summary refs log tree commit diff homepage
path: root/test/Concrete
diff options
context:
space:
mode:
Diffstat (limited to 'test/Concrete')
-rw-r--r--test/Concrete/CMakeLists.txt9
-rwxr-xr-xtest/Concrete/ConcreteTest.py7
-rw-r--r--test/Concrete/Makefile.cmake.test.in48
3 files changed, 63 insertions, 1 deletions
diff --git a/test/Concrete/CMakeLists.txt b/test/Concrete/CMakeLists.txt
new file mode 100644
index 00000000..b3e4948f
--- /dev/null
+++ b/test/Concrete/CMakeLists.txt
@@ -0,0 +1,9 @@
+#===------------------------------------------------------------------------===#
+#
+#                     The KLEE Symbolic Virtual Machine
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+configure_file(Makefile.cmake.test.in Makefile.cmake.test @ONLY)
diff --git a/test/Concrete/ConcreteTest.py b/test/Concrete/ConcreteTest.py
index 754c0fe6..66d18c83 100755
--- a/test/Concrete/ConcreteTest.py
+++ b/test/Concrete/ConcreteTest.py
@@ -8,11 +8,16 @@ import sys
 import shutil
 
 def testFile(name, klee_path, lli_path):
+    print("CWD: \"{}\"".format(os.getcwd()))
     baseName,ext = os.path.splitext(name)
     exeFile = 'Output/linked_%s.bc'%baseName
 
     print('-- building test bitcode --')
-    make_cmd = 'make %s 2>&1' % (exeFile,)
+    if os.path.exists("Makefile.cmake.test"):
+        # Prefer CMake generated make file
+        make_cmd = 'make -f Makefile.cmake.test %s 2>&1' % (exeFile,)
+    else:
+        make_cmd = 'make %s 2>&1' % (exeFile,)
     print("EXECUTING: %s" % (make_cmd,))
     sys.stdout.flush()
     if os.system(make_cmd):
diff --git a/test/Concrete/Makefile.cmake.test.in b/test/Concrete/Makefile.cmake.test.in
new file mode 100644
index 00000000..feb879de
--- /dev/null
+++ b/test/Concrete/Makefile.cmake.test.in
@@ -0,0 +1,48 @@
+#===------------------------------------------------------------------------===#
+#
+#                     The KLEE Symbolic Virtual Machine
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+#
+# @AUTO_GEN_MSG@
+#
+#===------------------------------------------------------------------------===#
+LLVMCC := @LLVMCC@
+LLVMAS := @LLVM_AS@
+LLVMLINK := @LLVM_LINK@
+LLVMCC.CFlags := -O0 -Wall
+
+# Make sure source files can match the pattern rules
+VPATH := @CMAKE_CURRENT_SOURCE_DIR@
+
+Output/.dir:
+	mkdir -p $@
+
+clean::
+	-rm -rf Output/
+
+Output/%.bc: %.c Output/.dir
+	$(LLVMCC) -emit-llvm -c $(LLVMCC.CFlags) $< -o $@
+
+Output/%.bc: %.ll $(LLVMAS) Output/.dir
+	$(LLVMAS) -f $< -o $@
+
+# We build a separate testingUtils bitcode for each test, to make sure parallel
+# tests don't interact with one another.
+Output/%_testingUtils.bc: _testingUtils.c Output/.dir
+	$(LLVMCC) -emit-llvm -c $(LLVMCC.CFlags) $< -o $@
+
+Output/linked_%.bc: Output/%.bc Output/%_testingUtils.bc
+	$(LLVMLINK) $< Output/$*_testingUtils.bc -o $@
+
+.PRECIOUS: Output/.dir
+
+## Cancel built-in implicit rules that override above rules
+%: %.s
+
+%: %.c
+
+%.o: %.c