Whamcloud - gitweb
LU-10217 test: Make sanity 248 work with newer dds 05/30005/5
authorNikolay Borisov <nborisov@suse.com>
Thu, 9 Nov 2017 10:39:19 +0000 (12:39 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 29 Nov 2017 05:59:34 +0000 (05:59 +0000)
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 <nborisov@suse.com>
Change-Id: I83ec659874ffe702c68f94f828827ff93325db72
Reviewed-on: https://review.whamcloud.com/30005
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity.sh

index 2e7aa51..d8b62ae 100755 (executable)
@@ -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 ] ||