From: Bernhard M. Wiedemann Date: Sat, 19 Oct 2024 08:49:53 +0000 (+0200) Subject: test: Make tests pass in 2038 (#1525) X-Git-Tag: v4.11~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a9911755365ad2a593b93452be219a7a2c0e49c;p=thirdparty%2Fccache.git test: Make tests pass in 2038 (#1525) 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 --- diff --git a/test/suites/base.bash b/test/suites/base.bash index fabf288c..f2af8700 100644 --- a/test/suites/base.bash +++ b/test/suites/base.bash @@ -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 <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