diff options
author | Timotej Kapus <tk1713@ic.ac.uk> | 2020-03-15 11:16:42 +0000 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2020-04-09 10:18:39 +0100 |
commit | c78b837d24f5df92b758b27e175b079ef2f1fbc0 (patch) | |
tree | fc4c472ffb00e40a7d03576547d7cb17a21c87d0 /test/Runtime/POSIX/SymFileConsistency.c | |
parent | 91d185a174631337f1ecee8b57d3f600c3fb311c (diff) | |
download | klee-c78b837d24f5df92b758b27e175b079ef2f1fbc0.tar.gz |
[posix-runtime] Add test for full path consistency for symbolic files
Diffstat (limited to 'test/Runtime/POSIX/SymFileConsistency.c')
-rw-r--r-- | test/Runtime/POSIX/SymFileConsistency.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/Runtime/POSIX/SymFileConsistency.c b/test/Runtime/POSIX/SymFileConsistency.c new file mode 100644 index 00000000..7a28232f --- /dev/null +++ b/test/Runtime/POSIX/SymFileConsistency.c @@ -0,0 +1,32 @@ +// REQUIRES: posix-runtime +// RUN: %clang %s -emit-llvm %O0opt -c -g -o %t.bc +// RUN: rm -rf %t.klee-out-tmp +// RUN: %gentmp %t.klee-out-tmp +// RUN: %klee --run-in-dir=%t.klee-out-tmp --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t1.log + +// This test checks that symbolic files can be resolved both with a relatve path +// ie. 'A' or by its full path ie. '/full/path/to/cwd/A' + +#include "klee/klee.h" + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> +#include <unistd.h> + +int main(int argc, char **argv) { + struct stat s, s1; + int res = stat("A", &s); + char cwd[1024]; + getcwd(cwd, 1024); + + char fullName[1024]; + snprintf(fullName, 1024, "%s/%s", cwd, "A"); + + res = stat(fullName, &s1); + assert(s.st_size == s1.st_size); + + return 0; +} |