about summary refs log tree commit diff homepage
path: root/test
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2020-11-26 18:08:57 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2020-12-23 16:50:11 +0000
commitbb6d9441d15e7205eb64ac4f53a2652940df180e (patch)
treebe0579ee6835d43100ee71728a491e7556c4a701 /test
parent4ea592d293152d708ce678952c516d8ecae75ff1 (diff)
downloadklee-bb6d9441d15e7205eb64ac4f53a2652940df180e.tar.gz
tests: add getcwd EINVAL test
Diffstat (limited to 'test')
-rw-r--r--test/Runtime/POSIX/GetcwdFail.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Runtime/POSIX/GetcwdFail.c b/test/Runtime/POSIX/GetcwdFail.c
new file mode 100644
index 00000000..3482d686
--- /dev/null
+++ b/test/Runtime/POSIX/GetcwdFail.c
@@ -0,0 +1,16 @@
+// RUN: %clang %s -emit-llvm %O0opt -c -o %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=klee --posix-runtime %t.bc
+
+#include <assert.h>
+#include <errno.h>
+#include <unistd.h>
+
+int main(void) {
+  // non-null path with 0 size should set EINVAL and return NULL
+  char *path[42];
+  errno = 0;
+  char *result = getcwd(path, 0);
+  assert(errno == EINVAL);
+  assert(result == NULL);
+}