about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartinNowack <martin.nowack@gmail.com>2015-09-26 14:21:44 +0200
committerMartinNowack <martin.nowack@gmail.com>2015-09-26 14:21:44 +0200
commit09ed8c23c9ca7e9d35013604e1133a371821dc5f (patch)
tree5f85c6a9fc462569be9c4c0ac5ec38ec10bba357
parente8fded10ccdaea3d9d72d178506d6aebb799394e (diff)
parent094e356340d523f09697a76e42e65cc951828253 (diff)
downloadklee-09ed8c23c9ca7e9d35013604e1133a371821dc5f.tar.gz
Merge pull request #281 from andrewchi/futimesat-fix
Don't use /tmp for futimesat unit test
-rw-r--r--test/Runtime/POSIX/Futimesat.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/Runtime/POSIX/Futimesat.c b/test/Runtime/POSIX/Futimesat.c
index 011fe56f..a6d9dc04 100644
--- a/test/Runtime/POSIX/Futimesat.c
+++ b/test/Runtime/POSIX/Futimesat.c
@@ -1,8 +1,7 @@
-// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t2.bc
-// RUN: touch /tmp/futimesat-dummy
+// RUN: %llvmgcc %s -emit-llvm -O0 -g -c -DTDIR=%T -o %t2.bc
+// RUN: touch %T/futimesat-dummy
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
-// RUN: rm /tmp/futimesat-dummy
 
 #include <assert.h>
 #include <fcntl.h>
@@ -11,6 +10,9 @@
 #include <time.h>
 #include <unistd.h>
 
+#define xstr(s) str(s)
+#define str(s) #s
+
 int main(int argc, char **argv) {
   int r;
   struct stat buf;
@@ -29,8 +31,8 @@ int main(int argc, char **argv) {
   assert(buf.st_atime == times[0].tv_sec &&
          buf.st_mtime == times[1].tv_sec);
 
-  /* assumes /tmp exists and is writeable */
-  int fd = open("/tmp", O_RDONLY);
+  /* assumes TDIR exists and is writeable */
+  int fd = open( xstr(TDIR) , O_RDONLY);
   assert(fd > 0);
   r = futimesat(fd, "futimesat-dummy", times);
   assert(r != -1);