On 26/07/2025 08:30, Nicolas Boichat wrote:
Hi,

I think this test might often be skipped due to lack of filesystem
support? Let's try a bit harder to run it.

And let's test past timestamps too.

Thanks!

Log:
## tests: du/bigtime: Try harder to find a suitable filesystem
At least on Linux, the "usual" filesystem (ext4) doesn't support
such large timestamp, while tmpfs does. Try a bit harder to look
for a filesystem with large timestamp support.
## tests: du/bigtime: Try both big and small timestamps
Try both future and past timestamps, for completeness.

I made the following changes, and pushed the first patch.
The second patch didn't handle the case where localtime
might support the large negative timestamp,
so I didn't push that one as it seems like
it might cause more trouble than it's worth.

Marking this as done.

thanks!
Padraig

diff --git a/tests/du/bigtime.sh b/tests/du/bigtime.sh
index 4f43464d5..d36e3f2e0 100755
--- a/tests/du/bigtime.sh
+++ b/tests/du/bigtime.sh
@@ -30,23 +30,23 @@ future=
 cleanup_() { rm -rf "$future"; }

 for fs in ./ /tmp /dev/shm; do
-  future=$(mktemp -p "$fs" future.XXXXXX)
-  touch -d @$bignum $future 2>/dev/null &&
+  future=$(mktemp -p "$fs" future.XXXXXX) || continue
+  touch -d @$bignum "$future" 2>/dev/null &&
   future_time=$(ls -l $future) &&
   case "$future_time" in
   *" $bignum "*)
     echo "file system at $fs handles big timestamps"
     good=1; break ;;
   *' Dec  4  300627798676 '*)
-    echo "file system at $fs and localtime both handle big timestamps" ;;
+    warn_ "file system at $fs and localtime both handle big timestamps" ;;
   *)
-    echo "file system at $fs or localtime mishandles big timestamps:" \
+    warn_ "file system at $fs or localtime mishandles big timestamps:" \
         "$future_time" ;;
-  esac || echo "file system at $fs cannot represent big timestamps"
-  rm $future
+  esac || warn_ "file system at $fs cannot represent big timestamps"
+  rm "$future"
 done

-[ -n $good ] || skip_ "Cannot find filesystem with big timestamp support"
+test "$good" = 1 || skip_ "Cannot find filesystem with big timestamp support"

 printf "0\t$bignum\t$future\n" > exp || framework_failure_
 printf "du: time '$bignum' is out of range\n" > err_ok || framework_failure_




Reply via email to