mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-02-11 01:42:17 +02:00
tests: cleanup background processes upon interruption
Reap background processes so that: - Stray processes aren't left on the system - Files aren't held open causing deletion issues on NFS - Partitions used to run the tests from can be unmounted * tests/tail-2/F-vs-missing.sh: Add the `kill && wait` of the background $pid(s) to cleanup_(). * tests/tail-2/F-vs-rename.sh: Likewise. * tests/tail-2/f-vs-rename.sh: Likewise. * tests/tail-2/append-only.sh: Likewise. * tests/tail-2/assert-2.sh: Likewise. * tests/tail-2/assert.sh: Likewise. * tests/tail-2/flush-initial.sh: Likewise. * tests/tail-2/inotify-hash-abuse.sh: Likewise. * tests/tail-2/inotify-hash-abuse2.sh: Likewise. * tests/tail-2/inotify-race.sh: Likewise. * tests/tail-2/inotify-rotate-resources.sh: Likewise. * tests/tail-2/inotify-rotate.sh: Likewise. * tests/tail-2/pid.sh: Likewise. * tests/tail-2/pipe-f2.sh: Likewise. * tests/tail-2/retry.sh: Likewise. * tests/tail-2/symlink.sh: Likewise. * tests/tail-2/tail-n0f.sh: Likewise. * tests/tail-2/wait.sh: Likewise. * tests/cp/existing-perm-race.sh: Likewise. * tests/cp/file-perm-race.sh: Likewise. * tests/cp/parent-perm-race.sh: Likewise. * tests/cp/sparse-to-pipe.sh: Likewise. * tests/dd/stats.sh: Likewise. * tests/du/move-dir-while-traversing.sh: Likewise. * tests/misc/cat-buf.sh: Likewise. * tests/misc/help-version.sh: Likewise. * tests/misc/printf-surprise.sh: Likewise. * tests/misc/sort-compress-proc.sh: Likewise. * tests/misc/sort-spinlock-abuse.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/misc/tac-continue.sh: Likewise. * tests/misc/timeout-group.sh: Likewise. * tests/mv/i-3.sh: Likewise. * tests/rm/dangling-symlink.sh: Likewise. * tests/rm/isatty.sh: Likewise. * cfg.mk (sc_prohibit_test_background_without_cleanup_): A new syntax-check to ensure cleanup_() is defined when background tasks are created in a test.
This commit is contained in:
@@ -71,10 +71,13 @@ for i in $(seq 50); do
|
||||
mkdir -p $t/3/a/b/c/$i/$long || framework_failure_
|
||||
done
|
||||
|
||||
# Terminate any background cp process
|
||||
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 &
|
||||
timeout 6 ./inotify-watch-for-dir-access.py $t/3/a/b > start-msg & pid=$!
|
||||
|
||||
# Wait for the watcher to start...
|
||||
nonempty() { test -s start-msg || { sleep $1; return 1; }; }
|
||||
|
||||
Reference in New Issue
Block a user