Tests were failing because the previous test gave up while trying to
unload the scsi_debug module. Try longer to remove it, and then throw
in a call to udevadm settle for good measure.
* tests/t-local.sh: Try harder to release resources here, rather than...
* tests/t9040-many-partitions.sh: ...in this one test.
* tests/t-local.sh (require_scsi_debug_module_): Now that
cleanup requires "udevadm settle", add that requirement here:
call require_udevadm_settle_.
require_scsi_debug_module_()
{
+ require_udevadm_settle_
# check for scsi_debug module
modprobe -n scsi_debug ||
skip_ "you lack the scsi_debug kernel module"
# We have to insist. Otherwise, a single rmmod usually fails to remove it,
# due either to "Resource temporarily unavailable" or to
# "Module scsi_debug is in use".
- for i in 1 2 3; do
+ i=0
+ udevadm settle
+ while [ $i -lt 10 ] ; do
rmmod scsi_debug \
&& { test "$VERBOSE" = yes && warn_ $ME_ rmmod scsi_debug...; break; }
sleep .2 || sleep 1
+ i=$((i + 1))
done
+ udevadm settle
fi
rm -fr $scsi_debug_lock_dir_
}
parted -m -s $scsi_dev u s p > out || fail=1
compare exp out || fail=1
-# We must remove these partitions before terminating.
-# Otherwise, even though cleanup-driven rmmod will eventually cause
-# them to be removed, they may continue to be removed long after
-# the rmmod cleanup lock has been released, and such removals
-# can (and regularly did) interfere with the following test.
-i=1
-while :; do
- parted -s $scsi_dev rm $i || fail=1
- test $i = $n_partitions && break
- i=$((i+1))
-done
-
Exit $fail