1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: kill process in flock group

There is no reason to wait for 10sec when removing 'vg' at test
exit - we just need to kill 'sleep 10' process forked from flock.

(Not using 'flock -F' as this flag is not across all machines used
for testing)
This commit is contained in:
Zdenek Kabelac 2024-05-10 17:36:48 +02:00
parent 87cd61c6bd
commit b678decfca

View File

@ -26,7 +26,7 @@ vgcreate $SHARED $vg "$dev1" "$dev2"
# if wait_for_locks set, vgremove should wait for global lock
# flock process should have exited by the time first vgremove completes
flock -w 5 "$TESTDIR/var/lock/lvm/P_global" sleep 10 &
flock -w 3 "$TESTDIR/var/lock/lvm/P_global" sleep 4 &
while ! test -f "$TESTDIR/var/lock/lvm/P_global" ; do sleep .1 ; done
vgremove --config 'global { wait_for_locks = 1 }' $vg
@ -38,12 +38,16 @@ test ! -f "$TESTDIR/var/lock/lvm/P_global"
# we must wait for flock process at the end - vgremove won't wait
vgcreate $SHARED $vg "$dev1" "$dev2"
flock -w 5 "$TESTDIR/var/lock/lvm/P_global" sleep 10 &
flock_pid=$!
while ! test -f "$TESTDIR/var/lock/lvm/P_global" ; do sleep .1 ; done
flock_pid=$(jobs -p)
not vgremove --config 'global { wait_for_locks = 0 }' $vg
test -f "$TESTDIR/var/lock/lvm/P_global" # still running
# First kill 'sleep' process forked from flock
# Not using 'flock -F' since this flag is newer
kill $(ps -o pid --no-headers --ppid "$flock_pid")
kill "$flock_pid"
vgremove -ff $vg