about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2014-09-15 07:22:45 -0700
committerDaniel Dunbar <daniel@zuster.org>2014-09-15 07:22:45 -0700
commit44c74907d97df031bd06023aec6f69d6fe9ba403 (patch)
tree8ce76ddeb9c7b2cc0518b8273b6f1b91c0ccadcf
parentaa000e933bda48ac67901b2a729dda7d5f9ca215 (diff)
parent9cc7df88676bf2d236f1af8dfcc47fda2ba12f12 (diff)
downloadklee-44c74907d97df031bd06023aec6f69d6fe9ba403.tar.gz
Merge pull request #160 from MartinNowack/fix_dirconsistency
Generate fake files for test cases
-rwxr-xr-xscripts/genTempFiles.sh12
-rw-r--r--test/Runtime/POSIX/DirConsistency.c10
-rw-r--r--test/Runtime/POSIX/DirSeek.c15
-rw-r--r--test/lit.cfg3
4 files changed, 30 insertions, 10 deletions
diff --git a/scripts/genTempFiles.sh b/scripts/genTempFiles.sh
new file mode 100755
index 00000000..f77cbcea
--- /dev/null
+++ b/scripts/genTempFiles.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+if [ -z "$1" ] ; then
+	echo "No directory given"
+	exit 1
+fi
+
+mkdir -p $1
+for i in `seq 1 100`; do
+	mkdir -p $1/dir_foo_$i
+	touch $1/tmp_foo_$i
+done    
diff --git a/test/Runtime/POSIX/DirConsistency.c b/test/Runtime/POSIX/DirConsistency.c
index 879dd75f..8faa9778 100644
--- a/test/Runtime/POSIX/DirConsistency.c
+++ b/test/Runtime/POSIX/DirConsistency.c
@@ -1,9 +1,11 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// RUN: rm -rf %t.klee-out
-// RUN: %klee --output-dir=%t.klee-out --run-in=/tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t1.log
+// RUN: rm -rf %t.klee-out %t.klee-out-tmp
+// RUN: %gentmp %t.klee-out-tmp
+// RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t1.log
 // RUN: %llvmgcc -D_FILE_OFFSET_BITS=64 %s -emit-llvm -O0 -c -o %t.bc
-// RUN: rm -rf %t.klee-out
-// RUN: %klee --output-dir=%t.klee-out --run-in=/tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t2.log
+// RUN: rm -rf %t.klee-out %t.klee-out-tmp
+// RUN: %gentmp %t.klee-out-tmp
+// RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t2.log
 // RUN: sort %t1.log %t2.log | uniq -c > %t3.log
 // RUN: grep -q "4 COUNT" %t3.log
 
diff --git a/test/Runtime/POSIX/DirSeek.c b/test/Runtime/POSIX/DirSeek.c
index 1b2c25e8..e017b98d 100644
--- a/test/Runtime/POSIX/DirSeek.c
+++ b/test/Runtime/POSIX/DirSeek.c
@@ -1,10 +1,13 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
-// RUN: rm -rf %t.klee-out
-// RUN: %klee --output-dir=%t.klee-out --run-in=/tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 2 2
-// RUN: rm -rf %t.klee-out
-// RUN: %klee --output-dir=%t.klee-out --run-in=/tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 1 2
-// RUN: rm -rf %t.klee-out
-// RUN: %klee --output-dir=%t.klee-out --run-in=/tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 0 2
+// RUN: rm -rf %t.klee-out %t.klee-out-tmp
+// RUN: %gentmp %t.klee-out-tmp
+// RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 2 2
+// RUN: rm -rf %t.klee-out %t.klee-out-tmp
+// RUN: %gentmp %t.klee-out-tmp
+// RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 1 2
+// RUN: rm -rf %t.klee-out %t.klee-out-tmp
+// RUN: %gentmp %t.klee-out-tmp
+// RUN: %klee --output-dir=%t.klee-out --run-in=%t.klee-out-tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 0 2
 
 // For this test really to work as intended it needs to be run in a
 // directory large enough to cause uclibc to do multiple getdents
diff --git a/test/lit.cfg b/test/lit.cfg
index ccd3b57e..25b48334 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -28,6 +28,8 @@ config.test_source_root = os.path.dirname(__file__)
 
 # test_exec_root: The root path where tests should be run.
 klee_obj_root = getattr(config, 'klee_obj_root', None)
+klee_src_root = getattr(config, 'klee_src_root', None)
+
 if klee_obj_root is not None:
     config.test_exec_root = os.path.join(klee_obj_root, 'test')
 
@@ -100,6 +102,7 @@ for s,basename,extra_args in subs:
                                  )
                                )
 
+config.substitutions.append( ('%gentmp', os.path.join(klee_src_root, 'scripts/genTempFiles.sh')) )
 
 # LLVM < 3.0 doesn't Support %T directive
 if int(config.llvm_version_major) == 2: