diff options
author | Michael D. Stemle, Jr <themanchicken@gmail.com> | 2018-10-07 22:38:55 -0400 |
---|---|---|
committer | Michael D. Stemle, Jr <themanchicken@gmail.com> | 2018-10-07 22:38:55 -0400 |
commit | 39a85e380c755cc676ccc467b5f204d32cca11d3 (patch) | |
tree | f26a603d6404ce94362d7b6258143e7a33d076e7 /test/test.sh | |
parent | 825043515fd5d09509ae212f785b4f9b5975279a (diff) | |
download | libfaketime-39a85e380c755cc676ccc467b5f204d32cca11d3.tar.gz |
Fixed a _bunch_ of autotools bugs.
Diffstat (limited to 'test/test.sh')
-rwxr-xr-x | test/test.sh | 70 |
1 files changed, 54 insertions, 16 deletions
diff --git a/test/test.sh b/test/test.sh index 630cec6..008cf56 100755 --- a/test/test.sh +++ b/test/test.sh @@ -1,14 +1,38 @@ #!/bin/sh +################################################################## +# NOTICE: # +# When you edit this script, maintain compatibility with BASH 3. # +# This is the version that Apple distributes. # +################################################################## + +LIB_BUILD_PATH="../src/$(grep 'LT_OBJDIR' ../config.h | cut -d'"' -f2)" +LIBFAKETIME_LA=$(find "$LIB_BUILD_PATH" | grep 'libfaketime\.\(dylib\|so\)$') + +set_libfaketime() { + the_path="$LIBFAKETIME_LA" + if [[ "$(uname)" = "Darwin" ]]; then + export DYLD_INSERT_LIBRARIES="$the_path" + export DYLD_FORCE_FLAT_NAMESPACE=1 + else + export LD_PRELOAD="$the_path" + fi +} + +echo $(set_libfaketime) + + 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 "\$ $(set_libfaketime) ./timetest" + set_libfaketime + ./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 "\$ $(set_libfaketime) ./timetest" + set_libfaketime + ./timetest echo fi @@ -16,48 +40,62 @@ 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 "\$ $(set_libfaketime) FAKETIME=\"2003-01-01 10:00:05\" ./timetest" +set_libfaketime +export 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 "\$ $(set_libfaketime) FAKETIME=\"@2005-03-29 14:14:14\" ./timetest" +set_libfaketime +export 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 "$(set_libfaketime) FAKETIME=\"-10d\" ./timetest" +set_libfaketime +export 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 "\$ $(set_libfaketime) FAKETIME=\"-10d\" NO_FAKE_STAT=1 ./timetest" +set_libfaketime +export FAKETIME="-10d" +export 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 "\$ $(set_libfaketime) FAKETIME=\"+10d x2\" ./timetest" +set_libfaketime +export FAKETIME="+10d x2" +export 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 "\$ $(set_libfaketime) FAKETIME=\"-15d\" date" +set_libfaketime +export FAKETIME="-15d" +date echo echo "=============================================================================" |