1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-23 21:35:29 +03:00

Make the lock test a little bit better...

This commit is contained in:
Milan Broz 2011-03-04 15:04:08 +00:00
parent 3e881b9726
commit ddb128b039

View File

@ -21,17 +21,21 @@ vgcreate $vg $dev1 $dev2
# if wait_for_locks set, vgremove should wait for orphan lock
# flock process should have exited by the time first vgremove completes
flock -w 5 $TESTDIR/var/lock/lvm/P_orphans -c "sleep 10" &
flock_pid=`jobs -p`
while ! test -f $TESTDIR/var/lock/lvm/P_orphans ; do sleep .1 ; done
vgremove --config 'global { wait_for_locks = 1 }' $vg
not vgremove --config 'global { wait_for_locks = 1 }' $vg
sleep .2 # leave some time for scheduler to exit flock process
not ps $flock_pid # finished
test ! -f $TESTDIR/var/lock/lvm/P_orphans
# if wait_for_locks not set, vgremove should fail on non-blocking lock
# we must wait for flock process at the end - vgremove won't wait
vgcreate $vg $dev1 $dev2
flock -w 5 $TESTDIR/var/lock/lvm/P_orphans -c "sleep 10" &
while ! test -f $TESTDIR/var/lock/lvm/P_orphans ; do sleep .1 ; done
flock_pid=`jobs -p`
not vgremove --config 'global { wait_for_locks = 0 }' $vg
ps $flock_pid # still running
test -f $TESTDIR/var/lock/lvm/P_orphans # still running
kill $flock_pid