about summary refs log tree commit diff homepage
path: root/test/Feature/NamedSeedMatching.c
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-05-21 04:36:41 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-05-21 04:36:41 +0000
commit6f290d8f9e9d7faac295cb51fc96884a18f4ded4 (patch)
tree46e7d426abc0c9f06ac472ac6f7f9e661b5d78cb /test/Feature/NamedSeedMatching.c
parenta55960edd4dcd7535526de8d2277642522aa0209 (diff)
downloadklee-6f290d8f9e9d7faac295cb51fc96884a18f4ded4.tar.gz
Initial KLEE checkin.
 - Lots more tweaks, documentation, and web page content is needed,
   but this should compile & work on OS X & Linux.


git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72205 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Feature/NamedSeedMatching.c')
-rw-r--r--test/Feature/NamedSeedMatching.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/Feature/NamedSeedMatching.c b/test/Feature/NamedSeedMatching.c
new file mode 100644
index 00000000..6d52e7a4
--- /dev/null
+++ b/test/Feature/NamedSeedMatching.c
@@ -0,0 +1,41 @@
+// RUN: %llvmgcc -c -g %s -o %t.bc
+// RUN: rm -rf %t.out
+// RUN: %klee --output-dir=%t.out %t.bc "initial"
+// RUN: test -f %t.out/test000001.bout
+// RUN: not test -f %t.out/test000002.bout
+// RUN: %klee --only-replay-seeds --named-seed-matching --seed-out %t.out/test000001.bout %t.bc > %t.log
+// RUN: grep -q "a==3" %t.log
+// RUN: grep -q "b==4" %t.log
+// RUN: grep -q "c==5" %t.log
+// RUN: grep -q "x==6" %t.log
+
+#include <string.h>
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+  int a, b, c, x;
+
+  if (argc==2 && strcmp(argv[1], "initial") == 0) {
+    klee_make_symbolic_name(&a, sizeof a, "a");
+    klee_make_symbolic_name(&b, sizeof b, "b");
+    klee_make_symbolic_name(&c, sizeof c, "c");
+    klee_make_symbolic_name(&x, sizeof x, "a");
+
+    klee_assume(a == 3);
+    klee_assume(b == 4);
+    klee_assume(c == 5);
+    klee_assume(x == 6);
+  } else {
+    klee_make_symbolic_name(&a, sizeof a, "a");
+    klee_make_symbolic_name(&c, sizeof c, "c");
+    klee_make_symbolic_name(&b, sizeof b, "b");
+    klee_make_symbolic_name(&x, sizeof x, "a");
+  }
+
+  if (a==3) printf("a==3\n");
+  if (b==4) printf("b==4\n");
+  if (c==5) printf("c==5\n");
+  if (x==6) printf("x==6\n");
+
+  return 0;
+}