From 5fb7d63e7d5ccd05f39b74b5c79d1856798477c7 Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Mon, 15 May 2017 22:04:48 +0800 Subject: [PATCH] LU-9140 nrs: calculate the measured rate according to dd runtime This patch help to calculate the measured IOPS by dd according to dd runtime, instead of obtaining the result from the performance data of dd output which value changes according to its unit: 'MB/s', 'GB/s' or 'kB/s'. Change-Id: Iace926d5c001f20b1c1d89ad6124d14a80316e86 Test-Parameters: trivial testlist=sanityn,sanityn,sanity Signed-off-by: Qian Yingjin Reviewed-on: https://review.whamcloud.com/27110 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Wang Shilong --- lustre/tests/sanityn.sh | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index a0bfb32..8275cc9 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -3135,6 +3135,17 @@ tbf_rule_operate() error "failed to run operate '$*' on TBF rules" } +cleanup_tbf_verify() +{ + local rc=0 + trap 0 + echo "cleanup_tbf $DIR/$tdir" + rm -rf $DIR/$tdir + rc=$? + wait_delete_completed + return $rc +} + tbf_verify() { local dir=$DIR/$tdir local client1=${CLIENT1:-$(hostname)} @@ -3144,29 +3155,32 @@ tbf_verify() { $LFS setstripe -c 1 $dir || error "setstripe to $dir failed" chmod 777 $dir + trap cleanup_tbf_verify EXIT echo "Limited write rate: $1, read rate: $2" echo "Verify the write rate is under TBF control" - local rate=$(do_node $client1 $myRUNAS dd if=/dev/zero of=$dir/tbf \ - bs=1M count=100 oflag=direct 2>&1 | awk '/bytes/ {print $8}') - echo "Write speed is $rate" + local runtime=$(do_node $client1 $myRUNAS dd if=/dev/zero of=$dir/tbf \ + bs=1M count=100 oflag=direct 2>&1 | awk '/bytes/ {print $6}') + local rate=$(bc <<< "scale=6; 100 / $runtime") + echo "Write runtime is $runtime s, speed is $rate IOPS" # verify the write rate does not exceed 110% of TBF limited rate [ $(bc <<< "$rate < 1.1 * $1") -eq 1 ] || - error_ignore LU-9140 "The write rate ($rate) exceeds 110% of preset rate ($1)" + error "The write rate ($rate) exceeds 110% of preset rate ($1)" cancel_lru_locks osc echo "Verify the read rate is under TBF control" - rate=$(do_node $client1 $myRUNAS dd if=$dir/tbf of=/dev/null \ - bs=1M count=100 iflag=direct 2>&1 | awk '/bytes/ {print $8}') - echo "Read speed is $rate" + runtime=$(do_node $client1 $myRUNAS dd if=$dir/tbf of=/dev/null \ + bs=1M count=100 iflag=direct 2>&1 | awk '/bytes/ {print $6}') + rate=$(bc <<< "scale=6; 100 / $runtime") + echo "Read runtime is $runtime s, speed is $rate IOPS" # verify the read rate does not exceed 110% of TBF limited rate [ $(bc <<< "$rate < 1.1 * $2") -eq 1 ] || - error_ignore LU-9140 "The read rate ($rate) exceeds 110% of preset rate ($2)" + error "The read rate ($rate) exceeds 110% of preset rate ($2)" cancel_lru_locks osc - rm -rf $dir || error "rm -rf $dir failed" + cleanup_tbf_verify || error "rm -rf $dir failed" } test_77e() { -- 1.8.3.1