From 406a315ee6f44526db759453490e4abf0f58352e Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 24 Aug 2018 13:14:26 -0700 Subject: [PATCH] test/qos: don't eat fio_py return value If fio.py fails, we need to fail the test. Running $fio_py in $() eats the return code and effectively does no QoS data checking - so it would always pass the test. Signed-off-by: Jim Harris Change-Id: I9960463e4d980784dd2622cfee658ea280ddb557 Reviewed-on: https://review.gerrithub.io/423424 Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System --- test/iscsi_tgt/qos/qos.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/iscsi_tgt/qos/qos.sh b/test/iscsi_tgt/qos/qos.sh index 660f32e1a..4604b8a06 100755 --- a/test/iscsi_tgt/qos/qos.sh +++ b/test/iscsi_tgt/qos/qos.sh @@ -9,7 +9,10 @@ function check_qos_works_well() { local enable_limit=$1 local iops_limit=$2/1000 local retval=0 - local read_iops=$($fio_py 8192 64 randread 5 | grep "\(read: IOPS=\|write: IOPS=\)" | + + $fio_py 8192 64 randread 5 > fio.txt + + local read_iops=$(cat fio.txt | grep "\(read: IOPS=\|write: IOPS=\)" | awk -F, '{print $1}' | awk -F= '{print $2}' | tr -d [k]) if [ $enable_limit = true ]; then retval=$(echo "$iops_limit*0.9 < $read_iops && $read_iops < $iops_limit*1.01" | bc) @@ -68,7 +71,7 @@ sleep 1 iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT -trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT +trap "iscsicleanup; rm -f fio.txt; killprocess $pid; exit 1" SIGINT SIGTERM EXIT # Limit the I/O rate by RPC, then confirm the observed rate matches. $rpc_py set_bdev_qos_limit_iops Malloc0 $IOPS_LIMIT @@ -84,6 +87,7 @@ check_qos_works_well true $IOPS_LIMIT echo "I/O rate limiting tests successful" iscsicleanup +rm -f fio.txt $rpc_py delete_target_node 'iqn.2016-06.io.spdk:Target1' rm -f ./local-job0-0-verify.state