From bb6d9441d15e7205eb64ac4f53a2652940df180e Mon Sep 17 00:00:00 2001 From: Frank Busse Date: Thu, 26 Nov 2020 18:08:57 +0000 Subject: tests: add getcwd EINVAL test --- test/Runtime/POSIX/GetcwdFail.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/Runtime/POSIX/GetcwdFail.c (limited to 'test') 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 +#include +#include + +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); +} -- cgit 1.4.1