]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
test: Make tests pass in 2038 (#1525)
authorBernhard M. Wiedemann <githubbmwprimary@lsmod.de>
Sat, 19 Oct 2024 08:49:53 +0000 (10:49 +0200)
committerGitHub <noreply@github.com>
Sat, 19 Oct 2024 08:49:53 +0000 (10:49 +0200)
We use relative future timestamps to keep systems with 32-bit time_t working
until 2037.

Use the 3rd of January of the following year to ensure that it is in the future,
even when starting a second before new year

test/suites/base.bash

index fabf288ce9adf744ce03a2c6bf0d7debf5a0fb7d..f2af87009fcfff347a1e18acc886041f4e3164c8 100644 (file)
@@ -284,8 +284,9 @@ fi
     # -------------------------------------------------------------------------
     TEST "Too new source file"
 
+    futuretimestamp=$(expr 1 + $(date -u +%Y))01030000
     touch new.c
-    touch -t 203801010000 new.c
+    touch -t $futuretimestamp new.c
 
     $CCACHE_COMPILE -c new.c
     expect_stat modified_input_file 1
@@ -304,7 +305,7 @@ EOF
     cat <<EOF >new.h
 int test;
 EOF
-    touch -t 203801010000 new.h
+    touch -t $futuretimestamp new.h
 
     $CCACHE_COMPILE -c new.c
     expect_stat modified_input_file 1
@@ -318,7 +319,7 @@ EOF
     TEST "Too new source file ignored if sloppy"
 
     touch new.c
-    touch -t 203801010000 new.c
+    touch -t $futuretimestamp new.c
 
     CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS include_file_mtime" $CCACHE_COMPILE -c new.c
     expect_stat cache_miss 1