From 22de28dc7c1247f2e7c557efa1ef8e6263dd7221 Mon Sep 17 00:00:00 2001 From: Nikolay Borisov Date: Thu, 9 Nov 2017 12:39:19 +0200 Subject: [PATCH] LU-10217 test: Make sanity 248 work with newer dds This patch fixes 2 problems when working with value from dd. Firstly, extraction of the readings from dd rely on them always being in field number 6. However, that's not true for newer dd versions where the output has changed and the time reading is now in field number 10. So to make the code more generic and work with both old and new outputs switch to using an egrep regular expression to extract the correct field. Secondly, dd can output its time in scientific notation, with decimal and floating point portion being separated by a comma rather than a dot: 4096 bytes (4,1 kB, 4,0 KiB) copied, 9,1229e-05 s, 44,9 MB/s Unforuntately this is not understood by bc so it needs to be processed by substituting the comma for a dot and also expanding the scientific notation to multiplication of 10 to the correct power. Test-Parameters: trivial Test-Parameters: clientdistro=sles12sp2 testlist=sanity Test-Parameters: clientdistro=sles12sp3 testlist=sanity Signed-off-by: Nikolay Borisov Change-Id: I83ec659874ffe702c68f94f828827ff93325db72 Reviewed-on: https://review.whamcloud.com/30005 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- lustre/tests/sanity.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 2e7aa51..d8b62ae 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -14399,12 +14399,13 @@ test_248() { # small read with fast read enabled $LCTL set_param -n llite.*.fast_read=1 local t_fast=$(dd if=$DIR/$tfile of=/dev/null bs=4k 2>&1 | - awk '/copied/ { print $6 }') - + egrep -o '([[:digit:]\.\,e-]+) s' | cut -d's' -f1 | + sed -e 's/,/./' -e 's/[eE]+*/\*10\^/') # small read with fast read disabled $LCTL set_param -n llite.*.fast_read=0 local t_slow=$(dd if=$DIR/$tfile of=/dev/null bs=4k 2>&1 | - awk '/copied/ { print $6 }') + egrep -o '([[:digit:]\.\,e-]+) s' | cut -d's' -f1 | + sed -e 's/,/./' -e 's/[eE]+*/\*10\^/') # verify that fast read is 4 times faster for cache read [ $(bc <<< "4 * $t_fast < $t_slow") -eq 1 ] || @@ -14417,12 +14418,14 @@ test_248() { # 1k non-cache read cancel_lru_locks osc local t_1k=$(dd if=$DIR/$tfile of=/dev/null bs=1k 2>&1 | - awk '/copied/ { print $6 }') + egrep -o '([[:digit:]\.\,e-]+) s' | cut -d's' -f1 | + sed -e 's/,/./' -e 's/[eE]+*/\*10\^/') # 1M non-cache read cancel_lru_locks osc local t_1m=$(dd if=$DIR/$tfile of=/dev/null bs=1k 2>&1 | - awk '/copied/ { print $6 }') + egrep -o '([[:digit:]\.\,e-]+) s' | cut -d's' -f1 | + sed -e 's/,/./' -e 's/[eE]+*/\*10\^/') # verify that big IO is not 4 times faster than small IO [ $(bc <<< "4 * $t_1k >= $t_1m") -eq 1 ] || -- 1.8.3.1