From b0d9114a6160b23a65c545a4cd65cfba45c493ff Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Wed, 7 Mar 2018 17:51:35 +0100 Subject: tests: don't use unlocked resources The test-suite did not survive when flock timeouts after 30s because then ts_cleanup_on_exit() may use resources (e.g. rmmod scsi_debug) while not having the lock. Signed-off-by: Ruediger Meier --- tests/functions.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/functions.sh') diff --git a/tests/functions.sh b/tests/functions.sh index 02f9a94f7..004ef0f3c 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -512,6 +512,12 @@ function ts_cleanup_on_exit { done unset TS_LOOP_DEVS + # just informative warnings, currently not seen + for resource in "${!TS_LOCKFILE_FD[@]}"; do + test -n "${TS_LOCKFILE_FD["resource"]}" || continue + echo "[$$ $TS_TESTNAME] warning: found unlocked $resource" + done + ts_scsi_debug_rmmod } @@ -660,6 +666,7 @@ function ts_fstab_add { } function ts_fstab_clean { + ts_have_lock "fstab" || return 0 sed --in-place " /#