mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +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:
parent
87cd61c6bd
commit
b678decfca
@ -26,7 +26,7 @@ vgcreate $SHARED $vg "$dev1" "$dev2"
|
|||||||
|
|
||||||
# if wait_for_locks set, vgremove should wait for global lock
|
# if wait_for_locks set, vgremove should wait for global lock
|
||||||
# flock process should have exited by the time first vgremove completes
|
# 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
|
while ! test -f "$TESTDIR/var/lock/lvm/P_global" ; do sleep .1 ; done
|
||||||
|
|
||||||
vgremove --config 'global { wait_for_locks = 1 }' $vg
|
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
|
# we must wait for flock process at the end - vgremove won't wait
|
||||||
vgcreate $SHARED $vg "$dev1" "$dev2"
|
vgcreate $SHARED $vg "$dev1" "$dev2"
|
||||||
flock -w 5 "$TESTDIR/var/lock/lvm/P_global" sleep 10 &
|
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
|
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
|
not vgremove --config 'global { wait_for_locks = 0 }' $vg
|
||||||
test -f "$TESTDIR/var/lock/lvm/P_global" # still running
|
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"
|
kill "$flock_pid"
|
||||||
|
|
||||||
vgremove -ff $vg
|
vgremove -ff $vg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user