diff --git a/scripts/gzip_tests.sh b/scripts/gzip_tests.sh index c8dcff7..f29dbf8 100755 --- a/scripts/gzip_tests.sh +++ b/scripts/gzip_tests.sh @@ -93,6 +93,9 @@ assert_equals() { fi } +# Get the filesystem type. +FSTYPE=$(df -T . | tail -1 | awk '{print $2}') + begin_test 'Basic compression and decompression works' cp file orig gzip file @@ -393,12 +396,20 @@ assert_error '\' gunzip -S '""' file begin_test 'Timestamps and mode are preserved' +if [ "$FSTYPE" = shiftfs ]; then + # In Travis CI, the filesystem (shiftfs) only supports seconds precision + # timestamps. Nanosecond precision still sometimes seems to work, + # probably due to caching, but it is unreliable. + format='%a;%X;%Y' +else + format='%a;%x;%y' +fi chmod 777 file -orig_stat="$(stat -c '%a;%x;%y' file)" +orig_stat="$(stat -c "$format" file)" gzip file sleep 1 gunzip file.gz -assert_equals "$orig_stat" "$(stat -c '%a;%x;%y' file)" +assert_equals "$orig_stat" "$(stat -c "$format" file)" begin_test 'Decompressing multi-member gzip file'