1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

tests: proper wait usage

Fix missing wait so we have paired waiting.
Also 'wait' for precise PID to get 'exit' code.

Test for 'error' replacing only with newer snapshot targets.
The old one will wait for resume.

Note: 'wait -n' is not always available so can't be used..
This commit is contained in:
Zdenek Kabelac 2016-09-29 13:18:18 +02:00
parent 43662fa081
commit 9e33781d95

View File

@ -42,6 +42,7 @@ dmsetup suspend $vg-$lv1
# now this should pass without blocking # now this should pass without blocking
dmsetup suspend --noflush --nolockfs $vg1-snap & dmsetup suspend --noflush --nolockfs $vg1-snap &
DMPID=$!
#dmsetup suspend $vg1-snap & #dmsetup suspend $vg1-snap &
sleep .5 sleep .5
@ -55,20 +56,28 @@ dmsetup resume $vg-$lv1
# otherwise --noudevsync would be needed # otherwise --noudevsync would be needed
dmsetup resume $vg1-snap dmsetup resume $vg1-snap
# Expecting success from 'dmsetup'
wait $DMPID
# Try how force removal works # Try how force removal works
dmsetup suspend $vg-$lv1 dmsetup suspend $vg-$lv1
# needs to fail as device is still open # needs to fail as device is still open
not dmsetup remove --force $vg1-snap & not dmsetup remove --force $vg1-snap &
DMPID=$!
# on older snapshot target 'remove' will wait till $lv1 is resumed
if aux target_at_least dm-snapshot 1 6 0 ; then
sleep .5 sleep .5
dmsetup table $vg1-snap | tee out dmsetup table $vg1-snap | tee out
should grep -i error out should grep -i error out
fi
dmsetup resume $vg-$lv1 dmsetup resume $vg-$lv1
wait # Expecting success from 'not dmsetup'
wait $DMPID
# check it really is now 'error' target # check it really is now 'error' target
dmsetup table $vg1-snap | tee out dmsetup table $vg1-snap | tee out