summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWolfgang Hommel <wolfgang.hommel@unibw.de>2019-08-21 18:42:05 +0200
committerWolfgang Hommel <wolfgang.hommel@unibw.de>2019-08-21 18:42:05 +0200
commit5ddb237842f2463ecfe5f43077bc90512903fbdc (patch)
tree17e1442f839c7b36eb728fa17bd7df2772dbc065 /test
parent314b1298c96d29c38b84ff8e5e027e2e65c81966 (diff)
downloadlibfaketime-5ddb237842f2463ecfe5f43077bc90512903fbdc.tar.gz
Adjusted tests on macOS based on compilation defaults
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_OSX.sh9
-rw-r--r--test/timetest.c11
2 files changed, 16 insertions, 4 deletions
diff --git a/test/test_OSX.sh b/test/test_OSX.sh
index afff4cb..49a754b 100755
--- a/test/test_OSX.sh
+++ b/test/test_OSX.sh
@@ -28,10 +28,11 @@ echo "FAKETIME=\"-10d\" ./timetest"
FAKETIME="-10d" ./timetest
echo
-echo "Running the test program with 10 days negative offset specified, and FAKE_STAT disabled"
-echo "FAKETIME=\"-10d\" NO_FAKE_STAT=1 ./timetest"
-FAKETIME="-10d" NO_FAKE_STAT=1 ./timetest
-echo
+# FAKE_STAT is disabled on macOS by default, so testing NO_FAKE_STAT is not useful
+#echo "Running the test program with 10 days negative offset specified, and FAKE_STAT disabled"
+#echo "FAKETIME=\"-10d\" NO_FAKE_STAT=1 ./timetest"
+#FAKETIME="-10d" NO_FAKE_STAT=1 ./timetest
+#echo
echo "Running the test program with 10 days positive offset specified, and sped up 2 times"
echo "FAKETIME=\"+10d x2\" ./timetest"
diff --git a/test/timetest.c b/test/timetest.c
index 4e3515c..285d0cc 100644
--- a/test/timetest.c
+++ b/test/timetest.c
@@ -25,11 +25,15 @@
#include <sys/time.h>
#include <sys/timeb.h>
+#ifndef __APPLE__
#ifdef FAKE_STAT
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#endif
+#else
+#include <unistd.h>
+#endif
#ifndef __APPLE__
#include <pthread.h>
@@ -125,9 +129,14 @@ int main (int argc, char **argv)
sigset_t mask;
struct sigaction sa;
#endif
+#ifndef __APPLE__
#ifdef FAKE_STAT
struct stat buf;
#endif
+#endif
+
+/* silence compiler warnings */
+printf("%s", 0 == 1 ? argv[0] : "");
#ifndef __APPLE__
pthread_t thread;
@@ -260,10 +269,12 @@ int main (int argc, char **argv)
}
#endif
+#ifndef __APPLE__
#ifdef FAKE_STAT
lstat(argv[0], &buf);
printf("stat(): mod. time of file '%s': %s", argv[0], ctime(&buf.st_mtime));
#endif
+#endif
return 0;
}