diff options
author | Andrea Mattavelli <andreamattavelli@users.noreply.github.com> | 2017-01-16 16:36:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-16 16:36:42 +0000 |
commit | aedbca881945da47005835a405188041b40ae7cc (patch) | |
tree | 84c553f78bc9e8bdcdd5b7aa2e2c9c78d84494dc /test/Replay/libkleeruntest/replay_invalid_num_objects.c | |
parent | 23e656156e4790a06a295d48932db53f2a582227 (diff) | |
parent | dcc709dd23fc8a50d5dc087d4d5961dea041bf01 (diff) | |
download | klee-aedbca881945da47005835a405188041b40ae7cc.tar.gz |
Merge pull request #566 from delcypher/fix_libkleeruntest
Fixes and testing for libkleeRuntest
Diffstat (limited to 'test/Replay/libkleeruntest/replay_invalid_num_objects.c')
-rw-r--r-- | test/Replay/libkleeruntest/replay_invalid_num_objects.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/Replay/libkleeruntest/replay_invalid_num_objects.c b/test/Replay/libkleeruntest/replay_invalid_num_objects.c new file mode 100644 index 00000000..43bc4867 --- /dev/null +++ b/test/Replay/libkleeruntest/replay_invalid_num_objects.c @@ -0,0 +1,39 @@ +// Compile program that only makes one klee_make_symbolic() call +// RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc +// RUN: rm -rf %t.klee-out +// RUN: %klee --output-dir=%t.klee-out --search=dfs %t.bc +// RUN: test -f %t.klee-out/test000001.ktest + +// Now try to replay with libkleeRuntest but build the binary so it +// makes two calls to klee_make_symbolic. +// RUN: %cc -DEXTRA_MAKE_SYMBOLIC %s %libkleeruntest -Wl,-rpath=%libkleeruntestdir -o %t_runner + +// Check that the default is to exit with an error +// RUN: not env KTEST_FILE=%t.klee-out/test000001.ktest %t_runner 2>&1 | FileCheck -check-prefix=CHECK_FATAL %s + +// Check that setting `KLEE_RUN_TEST_ERRORS_NON_FATAL` will not exit with an error +// and will continue executing. +// RUN: env KTEST_FILE=%t.klee-out/test000001.ktest KLEE_RUN_TEST_ERRORS_NON_FATAL=1 %t_runner 2>&1 | FileCheck %s + +#include "klee/klee.h" +#include <stdio.h> + +int main(int argc, char** argv) { + int x = 0; + klee_make_symbolic(&x, sizeof(x), "x"); + +#ifdef EXTRA_MAKE_SYMBOLIC + int y = 1; + klee_make_symbolic(&y, sizeof(y), "x"); + klee_assume(y == 0); + fprintf(stderr, "y is \"%d\"\n", y); +#endif + return 0; +} +// CHECK: KLEE_RUN_TEST_ERROR: out of inputs +// CHECK: KLEE_RUN_TEST_ERROR: Forcing execution to continue +// CHECK: y is "0" + +// CHECK_FATAL: KLEE_RUN_TEST_ERROR: out of inputs +// CHECK_FATAL-NOT: y is "0" + |