about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorAndrew Chi <achi@cs.unc.edu>2015-09-24 15:14:28 -0400
committerAndrew Chi <achi@cs.unc.edu>2015-09-25 11:06:47 -0400
commit094e356340d523f09697a76e42e65cc951828253 (patch)
tree5f85c6a9fc462569be9c4c0ac5ec38ec10bba357
parente8fded10ccdaea3d9d72d178506d6aebb799394e (diff)
downloadklee-094e356340d523f09697a76e42e65cc951828253.tar.gz
Don't use /tmp for futimesat unit test
This causes problems on a shared machine where multiple users are running the
KLEE unit tests.
-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);