diff options
author | Saveliy Grigoryev <sava-cska@mail.ru> | 2022-06-27 17:04:39 +0300 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2022-06-27 17:12:25 +0100 |
commit | 44ebccb0529e2fd9f063bf544c8535104b9b0419 (patch) | |
tree | 1de752364c3390de6bb2caee3efad45e3c835843 | |
parent | 42bca7ee2db48b0fc080cdb4af6a05cb666efb8c (diff) | |
download | klee-44ebccb0529e2fd9f063bf544c8535104b9b0419.tar.gz |
Fix error with empty EntryPoint
-rw-r--r-- | test/Feature/EntryPoint.c | 10 | ||||
-rw-r--r-- | tools/klee/main.cpp | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/test/Feature/EntryPoint.c b/test/Feature/EntryPoint.c index 82659733..8a10d36f 100644 --- a/test/Feature/EntryPoint.c +++ b/test/Feature/EntryPoint.c @@ -1,11 +1,17 @@ // RUN: %clang -emit-llvm -g -c %s -o %t.bc // RUN: rm -rf %t.klee-out -// RUN: %klee --output-dir=%t.klee-out --entry-point=other_main %t.bc > %t.log -// RUN: grep "Hello World" %t.log +// RUN: %klee --output-dir=%t.klee-out --entry-point=other_main %t.bc | FileCheck -check-prefix=CHECK-OTHER_MAIN %s + +// RUN: rm -rf %t.klee-out +// RUN: %klee --output-dir=%t.klee-out --entry-point="" %t.bc 2>%t.stderr.log || echo "Exit status must be 0" +// RUN: FileCheck -check-prefix=CHECK-EMPTY --input-file=%t.stderr.log %s #include <stdio.h> int other_main() { printf("Hello World\n"); + // CHECK-OTHER_MAIN: Hello World return 0; } + +// CHECK-EMPTY: KLEE: ERROR: entry-point cannot be empty diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp index dd839de6..3b0731c8 100644 --- a/tools/klee/main.cpp +++ b/tools/klee/main.cpp @@ -1151,6 +1151,10 @@ int main(int argc, char **argv, char **envp) { parseArguments(argc, argv); sys::PrintStackTraceOnErrorSignal(argv[0]); + if (EntryPoint.empty()) { + klee_error("entry-point cannot be empty"); + } + if (Watchdog) { if (MaxTime.empty()) { klee_error("--watchdog used without --max-time"); |