about summary refs log tree commit diff homepage
path: root/test/regression
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2014-01-12 21:34:59 +0000
committerDan Liew <daniel.liew@imperial.ac.uk>2014-01-20 14:45:07 +0000
commit38a084fb50cfb38570d0194bb076805e4f752c99 (patch)
tree598b00ceae9e12773e61b6e6657d654afc00360e /test/regression
parent313390c68fc808d5fe7cf746a7a65b1e018362dc (diff)
downloadklee-38a084fb50cfb38570d0194bb076805e4f752c99.tar.gz
Fixed many tests that make use of the file tool to check
a file created by KLEE exists. A big difference between
DejaGNU and llvm-lit is that in DejaGNU the working directory
is the test output directory (e.g. test/Feature/Output) but
in llvm-lit the working directory is the test directory
(e.g. test/Feature )

To fix this I have used the %T substitution variable for llvm-lit.

I have also improved some tests by using LLVM's FileCheck tool
and removing of hard coded constants for data type size in
some places.

This commit inevitably breaks running the tests under DejaGNU.
Although it is possible to hack by introducing the %T substitution
variable some tests would still be broken because the use of shell
pipes in DejaGNU doesn't seem to work properly. I could work around
this but it's really not worth the effort.
Diffstat (limited to 'test/regression')
-rw-r--r--test/regression/2007-10-11-free-of-alloca.c7
-rw-r--r--test/regression/2007-10-11-illegal-access-after-free-and-branch.c7
-rw-r--r--test/regression/2008-03-04-free-of-global.c7
3 files changed, 13 insertions, 8 deletions
diff --git a/test/regression/2007-10-11-free-of-alloca.c b/test/regression/2007-10-11-free-of-alloca.c
index 71a16f6b..44a9ed4e 100644
--- a/test/regression/2007-10-11-free-of-alloca.c
+++ b/test/regression/2007-10-11-free-of-alloca.c
@@ -1,9 +1,10 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
-// RUN: test -f klee-last/test000001.free.err
+// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %klee %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %T/klee-last/test000001.free.err
 
 int main() {
   int buf[4];
+  // CHECK: 2007-10-11-free-of-alloca.c:8: free of alloca
   free(buf); // this should give runtime error, not crash
   return 0;
 }
diff --git a/test/regression/2007-10-11-illegal-access-after-free-and-branch.c b/test/regression/2007-10-11-illegal-access-after-free-and-branch.c
index fbbb99c3..73b3ed3f 100644
--- a/test/regression/2007-10-11-illegal-access-after-free-and-branch.c
+++ b/test/regression/2007-10-11-illegal-access-after-free-and-branch.c
@@ -1,6 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee --optimize %t1.bc
-// RUN: test -f klee-last/test000001.ptr.err
+// RUN: %klee --optimize %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %T/klee-last/test000001.ptr.err
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -13,7 +13,10 @@ int main(int argc, char **argv) {
   unsigned char x = buf[1];
   free(buf);
   if (x)
+  {
+    // CHECK: 2007-10-11-illegal-access-after-free-and-branch.c:18: memory error: out of bound pointer
     return buf[2];
+  }
   klee_silent_exit(0);
   return 0;
 }
diff --git a/test/regression/2008-03-04-free-of-global.c b/test/regression/2008-03-04-free-of-global.c
index 7821398d..5351128d 100644
--- a/test/regression/2008-03-04-free-of-global.c
+++ b/test/regression/2008-03-04-free-of-global.c
@@ -1,10 +1,11 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
-// RUN: test -f klee-last/test000001.free.err
+// RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
+// RUN: %klee %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %T/klee-last/test000001.free.err
 
 int buf[4];
 
 int main() {
+  // CHECK: 2008-03-04-free-of-global.c:9: free of global
   free(buf); // this should give runtime error, not crash
   return 0;
 }