about summary refs log tree commit diff homepage
path: root/test
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2022-04-22 17:22:16 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2022-06-13 22:30:53 +0100
commitd677b57d384a66781aca9c897e440f7e23ab44c4 (patch)
tree35e5ed32069cb87f86d8837676050c5a86cd2b34 /test
parent168daea0661f6e18dc85e967ff572f33a76a2bc5 (diff)
downloadklee-d677b57d384a66781aca9c897e440f7e23ab44c4.tar.gz
tests: add StackTraceOutput.c
Diffstat (limited to 'test')
-rw-r--r--test/Feature/StackTraceOutput.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Feature/StackTraceOutput.c b/test/Feature/StackTraceOutput.c
new file mode 100644
index 00000000..3d4e3c51
--- /dev/null
+++ b/test/Feature/StackTraceOutput.c
@@ -0,0 +1,29 @@
+// REQUIRES: geq-llvm-7.0
+// RUN: %clang %s -emit-llvm %O0opt -g -c -fdiscard-value-names -o %t.bc
+// RUN: rm -rf %t.klee-out-d
+// RUN: %klee --output-dir=%t.klee-out-d %t.bc
+// RUN: FileCheck -input-file=%t.klee-out-d/test000001.assert.err -check-prefix=CHECK-DISCARD %s
+
+// RUN: %clang %s -emit-llvm %O0opt -g -c -fno-discard-value-names -o %t.bc
+// RUN: rm -rf %t.klee-out-n
+// RUN: %klee --output-dir=%t.klee-out-n %t.bc
+// RUN: FileCheck -input-file=%t.klee-out-n/test000001.assert.err -check-prefix=CHECK-NODISCARD %s
+
+#include "klee/klee.h"
+
+#include <assert.h>
+
+void foo(int i, int k) {
+  ++i; ++k;
+  assert(0);
+  // CHECK-DISCARD: {{.*}} in foo(symbolic, 12) at {{.*}}.c:18
+  // CHECK-DISCARD: {{.*}} in main() at {{.*}}.c:28
+  // CHECK-NODISCARD: {{.*}} in foo(i=symbolic, k=12) at {{.*}}.c:18
+  // CHECK-NODISCARD: {{.*}} in main() at {{.*}}.c:28
+}
+
+int main(void) {
+  int i, k=12;
+  klee_make_symbolic(&i, sizeof(i), "i");
+  foo(i,k);
+}