From f876a456153d09b0cda04f880c89479bdfc7ad13 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Tue, 22 Oct 2024 18:48:27 +0200 Subject: [PATCH] test: Add and use postdate function for making future filestamps --- test/run | 4 ++++ test/suites/base.bash | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/run b/test/run index cb176050..e098875a 100755 --- a/test/run +++ b/test/run @@ -141,6 +141,10 @@ backdate() { touch -t $((199901010000 + m)) "$@" } +postdate() { + touch -t "$(($(date -u +%Y) + 1))01030000" "$@" +} + file_size() { wc -c $1 | awk '{print $1}' } diff --git a/test/suites/base.bash b/test/suites/base.bash index f2af8700..6cbbaaeb 100644 --- a/test/suites/base.bash +++ b/test/suites/base.bash @@ -284,9 +284,7 @@ fi # ------------------------------------------------------------------------- TEST "Too new source file" - futuretimestamp=$(expr 1 + $(date -u +%Y))01030000 - touch new.c - touch -t $futuretimestamp new.c + postdate new.c $CCACHE_COMPILE -c new.c expect_stat modified_input_file 1 @@ -305,7 +303,7 @@ EOF cat <new.h int test; EOF - touch -t $futuretimestamp new.h + postdate new.h $CCACHE_COMPILE -c new.c expect_stat modified_input_file 1 @@ -318,8 +316,7 @@ EOF # ------------------------------------------------------------------------- TEST "Too new source file ignored if sloppy" - touch new.c - touch -t $futuretimestamp new.c + postdate new.c CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS include_file_mtime" $CCACHE_COMPILE -c new.c expect_stat cache_miss 1 -- 2.47.2