]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: du: avoid false failure in racy test
authorPádraig Brady <P@draigBrady.com>
Sun, 21 Sep 2025 19:14:10 +0000 (20:14 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 21 Sep 2025 23:09:03 +0000 (00:09 +0100)
* tests/du/move-dir-while-traversing.sh: Expand the work to avoid
a false failure where du completes before the directory is moved.
Also expand the timeout to our more standard 10s to avoid the
"directory mover" being killed before du processes the directory.
This doesn't perceptibly impact the run time of the test.
Reported by Bruno Haible on a CentOS 7 system.

tests/du/move-dir-while-traversing.sh

index 1d0a359bfc4a5351bcc907113a2a5bae319b4122..adf482b8e6021dcf60689fa005633ad9920ce16c 100755 (executable)
@@ -66,9 +66,8 @@ long=d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z
 # du sometimes completes its traversal before the above rename.
 # Five iterations was not enough in 2 of 7 "make -j20 check" runs on a
 # 6/12-core system.  However, using "10", I saw no failure in 20 trials.
-# Using 10 iterations was not enough, either.
-# Using 50, I saw no failure in 200 trials.
-for i in $(seq 50); do
+# 2011 this was set at 50, 2025 this was set at 99
+for i in $(seq 99); do
   mkdir -p $t/3/a/b/c/$i/$long || framework_failure_
 done
 
@@ -78,7 +77,7 @@ cleanup_() { kill $pid 2>/dev/null && wait $pid; }
 # Prohibit suspension, which could otherwise cause a timeout-induced FP failure.
 trap '' TSTP
 
-timeout 6 ./inotify-watch-for-dir-access.py $t/3/a/b > start-msg & pid=$!
+timeout 10 ./inotify-watch-for-dir-access.py $t/3/a/b > start-msg & pid=$!
 
 # Wait for the watcher to start...
 nonempty() { sleep $1; test -s start-msg; }