test/iscsi_tgt: optimization for ext4 test.
This patch make sure the mkfs command only run for 1 time for all the devices. Change-Id: Ic2fce52580d0ff871c77f56fce60ec5ca79e513c Signed-off-by: cunyinch <cunyin.chang@intel.com> Reviewed-on: https://review.gerrithub.io/361907 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: GangCao <gang.cao@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
2ef5722f3c
commit
7fb3b2484c
@ -42,10 +42,7 @@ $rpc_py construct_error_bdev 'Malloc0'
|
||||
# "1:2" ==> map PortalGroup1 to InitiatorGroup2
|
||||
# "64" ==> iSCSI queue depth 64
|
||||
# "1 0 0 0" ==> disable CHAP authentication
|
||||
if [ -z "$NO_NVME" ]; then
|
||||
$rpc_py construct_target_node Target0 Target0_alias Nvme0n1:0 1:2 64 1 0 0 0
|
||||
fi
|
||||
$rpc_py construct_target_node Target1 Target1_alias EE_Malloc0:0 1:2 64 1 0 0 0
|
||||
$rpc_py construct_target_node Target0 Target0_alias EE_Malloc0:0 1:2 64 1 0 0 0
|
||||
sleep 1
|
||||
|
||||
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$PORT
|
||||
@ -56,30 +53,37 @@ trap 'for new_dir in `dir -d /mnt/*dir`; do umount $new_dir; rm -rf $new_dir; do
|
||||
|
||||
sleep 1
|
||||
|
||||
echo "Test error injection"
|
||||
$rpc_py bdev_inject_error 'all' -n 1000
|
||||
|
||||
devs=$(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}')
|
||||
dev=$(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}')
|
||||
|
||||
declare -i failcount=0
|
||||
set +e
|
||||
for dev in $devs; do
|
||||
mkfs.ext4 -F /dev/$dev
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "mkfs successful"
|
||||
echo "mkfs successful - expected failure"
|
||||
iscsicleanup
|
||||
killprocess $pid
|
||||
rm -f $testdir/iscsi.conf
|
||||
exit 1
|
||||
else
|
||||
echo "mkfs failed"
|
||||
failcount+=1
|
||||
echo "mkfs failed as expected"
|
||||
fi
|
||||
done
|
||||
set -e
|
||||
|
||||
if [ $failcount -eq 1 ]; then
|
||||
echo "error injection success"
|
||||
else
|
||||
exit 1
|
||||
$rpc_py bdev_inject_error 'clear'
|
||||
echo "Error injection test done"
|
||||
|
||||
iscsicleanup
|
||||
|
||||
if [ -z "$NO_NVME" ]; then
|
||||
$rpc_py construct_target_node Target1 Target1_alias Nvme0n1:0 1:2 64 1 0 0 0
|
||||
fi
|
||||
|
||||
$rpc_py bdev_inject_error 'clear'
|
||||
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$PORT
|
||||
iscsiadm -m node --login -p $TARGET_IP:$PORT
|
||||
|
||||
devs=$(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}')
|
||||
|
||||
for dev in $devs; do
|
||||
mkfs.ext4 -F /dev/$dev
|
||||
|
Loading…
Reference in New Issue
Block a user