From b8bc26c931aa070c0f26382bdde105000be81c39 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Wed, 5 Jun 2024 09:34:11 +0000 Subject: [PATCH] tests/generic: remove recover-failed device When device recovery fails, log the failure and remove the device, otherwise, it may cause device leak. Signed-off-by: Ming Lei --- tests/generic/005 | 9 ++++----- tests/generic/006 | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/generic/005 b/tests/generic/005 index 5d57e83f..162ef5b5 100755 --- a/tests/generic/005 +++ b/tests/generic/005 @@ -63,14 +63,13 @@ ublk_run_recover_test() let secs++ done if [ $RES -ne 0 ]; then - echo -e "\trecover $DEV failed" - exit -1 + echo -e "\trecover $DEV failed" fi sleep 2 RES=`__remove_ublk_dev_return $DEV` if [ $RES -ne 0 ]; then - echo -e "\tdelete $DEV failed" - exit -1 + echo -e "\tdelete $DEV failed" + break fi wait sleep 3 @@ -80,6 +79,6 @@ ublk_run_recover_test() for TGT in $ALL_TGTS; do for RECOVERY_REISSUE in `seq 0 1`; do - ublk_run_recover_test $TGT + ublk_run_recover_test $TGT done done diff --git a/tests/generic/006 b/tests/generic/006 index 3924d72f..ab8366fc 100755 --- a/tests/generic/006 +++ b/tests/generic/006 @@ -43,8 +43,7 @@ ublk_run_recover_kill_test() let secs++ done if [ $RES -ne 0 ]; then - echo -e "\trecover $DEV failed" - exit -1 + echo -e "\trecover $DEV failed" fi sleep 2 pid2=`__ublk_get_pid $DEV` @@ -53,7 +52,7 @@ ublk_run_recover_kill_test() RES=`__remove_ublk_dev_return $DEV` if [ $RES -ne 0 ]; then echo -e "\tdelete $DEV failed" - exit -1 + break fi wait sleep 3 @@ -61,5 +60,5 @@ ublk_run_recover_kill_test() } for RECOVERY_REISSUE in `seq 0 1`; do - ublk_run_recover_kill_test + ublk_run_recover_kill_test done