Skip to content

Commit

Permalink
tests/generic: remove recover-failed device
Browse files Browse the repository at this point in the history
When device recovery fails, log the failure and remove the device,
otherwise, it may cause device leak.

Signed-off-by: Ming Lei <[email protected]>
  • Loading branch information
ming1 committed Jun 5, 2024
1 parent 30f52dc commit b8bc26c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
9 changes: 4 additions & 5 deletions tests/generic/005
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
7 changes: 3 additions & 4 deletions tests/generic/006
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -53,13 +52,13 @@ 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
done
}

for RECOVERY_REISSUE in `seq 0 1`; do
ublk_run_recover_kill_test
ublk_run_recover_kill_test
done

0 comments on commit b8bc26c

Please sign in to comment.