From 47ae3ba9fcefae4d170c16f2fb54c489a38855c9 Mon Sep 17 00:00:00 2001 From: Frank Busse Date: Wed, 1 Nov 2017 20:56:01 +0000 Subject: klee_make_symbolic: add test cases for API --- test/Feature/MakeSymbolicAPI.c | 19 +++++++++++++++++++ test/regression/2017-11-01-test-with-empty-varname.c | 11 +++++++++++ 2 files changed, 30 insertions(+) create mode 100644 test/Feature/MakeSymbolicAPI.c create mode 100644 test/regression/2017-11-01-test-with-empty-varname.c (limited to 'test') diff --git a/test/Feature/MakeSymbolicAPI.c b/test/Feature/MakeSymbolicAPI.c new file mode 100644 index 00000000..0ff4b82f --- /dev/null +++ b/test/Feature/MakeSymbolicAPI.c @@ -0,0 +1,19 @@ +// RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc +// RUN: rm -rf %t.klee-out +// RUN: %klee --output-dir=%t.klee-out %t1.bc 2> %t.stderr.log +// RUN: FileCheck %s -check-prefix=CHECK-WRN --input-file=%t.klee-out/warnings.txt +// RUN: FileCheck %s -check-prefix=CHECK-ERR --input-file=%t.stderr.log + +int main() { + unsigned a, b, c; + + klee_make_symbolic(&a, sizeof(a), ""); +// CHECK-WRN: KLEE: WARNING: klee_make_symbolic: renamed empty name to "unnamed" + + klee_make_symbolic(&b, sizeof(b)); +// CHECK-WRN: KLEE: WARNING: klee_make_symbolic: deprecated number of arguments (2 instead of 3) +// CHECK-WRN: KLEE: WARNING: klee_make_symbolic: renamed empty name to "unnamed" + + klee_make_symbolic(&c); +// CHECK-ERR: KLEE: ERROR: {{.*}} illegal number of arguments to klee_make_symbolic(void*, size_t, char*) +} diff --git a/test/regression/2017-11-01-test-with-empty-varname.c b/test/regression/2017-11-01-test-with-empty-varname.c new file mode 100644 index 00000000..5d73ea20 --- /dev/null +++ b/test/regression/2017-11-01-test-with-empty-varname.c @@ -0,0 +1,11 @@ +// RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc +// RUN: rm -rf %t.klee-out +// RUN: %klee --output-dir=%t.klee-out %t1.bc +// RUN: FileCheck %s --input-file=%t.klee-out/warnings.txt + +int main() { + unsigned a; + + klee_make_symbolic(&a, sizeof(a), ""); +// CHECK-NOT: KLEE: WARNING: unable to write output test case, losing it +} -- cgit 1.4.1