summaryrefslogtreecommitdiffstats
path: root/tests/deckard/contrib/libfaketime/test/test.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
commit3d0386f27ca66379acf50199e1d1298386eeeeb8 (patch)
treef87bd4a126b3a843858eb447e8fd5893c3ee3882 /tests/deckard/contrib/libfaketime/test/test.sh
parentInitial commit. (diff)
downloadknot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.tar.xz
knot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.zip
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/deckard/contrib/libfaketime/test/test.sh')
-rwxr-xr-xtests/deckard/contrib/libfaketime/test/test.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/deckard/contrib/libfaketime/test/test.sh b/tests/deckard/contrib/libfaketime/test/test.sh
new file mode 100755
index 0000000..630cec6
--- /dev/null
+++ b/tests/deckard/contrib/libfaketime/test/test.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+if [ -f /etc/faketimerc ] ; then
+ echo "Running the test program with your system-wide default in /etc/faketimerc"
+ echo "\$ LD_PRELOAD=../src/libfaketime.so.1 ./timetest"
+ LD_PRELOAD=../src/libfaketime.so.1 ./timetest
+ echo
+else
+ echo "Running the test program with no faked time specified"
+ echo "\$ LD_PRELOAD=../src/libfaketime.so.1 ./timetest"
+ LD_PRELOAD=../src/libfaketime.so.1 ./timetest
+ echo
+fi
+
+echo "============================================================================="
+echo
+
+echo "Running the test program with absolute date 2003-01-01 10:00:05 specified"
+echo "\$ LD_PRELOAD=../src/libfaketime.so.1 FAKETIME=\"2003-01-01 10:00:05\" ./timetest"
+LD_PRELOAD=../src/libfaketime.so.1 FAKETIME="2003-01-01 10:00:05" ./timetest
+echo
+
+echo "============================================================================="
+echo
+
+echo "Running the test program with START date @2005-03-29 14:14:14 specified"
+echo "\$ LD_PRELOAD=../src/libfaketime.so.1 FAKETIME=\"@2005-03-29 14:14:14\" ./timetest"
+LD_PRELOAD=../src/libfaketime.so.1 FAKETIME="@2005-03-29 14:14:14" ./timetest
+echo
+
+echo "============================================================================="
+echo
+
+echo "Running the test program with 10 days negative offset specified"
+echo "LD_PRELOAD=../src/libfaketime.so.1 FAKETIME=\"-10d\" ./timetest"
+LD_PRELOAD=../src/libfaketime.so.1 FAKETIME="-10d" ./timetest
+echo
+
+echo "============================================================================="
+echo
+
+echo "Running the test program with 10 days negative offset specified, and FAKE_STAT disabled"
+echo "\$ LD_PRELOAD=../src/libfaketime.so.1 FAKETIME=\"-10d\" NO_FAKE_STAT=1 ./timetest"
+LD_PRELOAD=../src/libfaketime.so.1 FAKETIME="-10d" NO_FAKE_STAT=1 ./timetest
+echo
+
+echo "============================================================================="
+echo
+
+echo "Running the test program with 10 days positive offset specified, and sped up 2 times"
+echo "\$ LD_PRELOAD=../src/libfaketime.so.1 FAKETIME=\"+10d x2\" ./timetest"
+LD_PRELOAD=../src/libfaketime.so.1 FAKETIME="+10d x2" NO_FAKE_STAT=1 ./timetest
+echo
+
+echo "============================================================================="
+echo
+
+echo "Running the 'date' command with 15 days negative offset specified"
+echo "\$ LD_PRELOAD=../src/libfaketime.so.1 FAKETIME=\"-15d\" date"
+LD_PRELOAD=../src/libfaketime.so.1 FAKETIME="-15d" date
+echo
+
+echo "============================================================================="
+echo "Testing finished."
+
+exit 0