Whamcloud - gitweb
LU-12446 tests: Fix use of undefined variable under sanityn.sh/16b 46/35246/5
authorArshad Hussain <arshad.super@gmail.com>
Mon, 17 Jun 2019 18:49:02 +0000 (00:19 +0530)
committerOleg Drokin <green@whamcloud.com>
Thu, 27 Jun 2019 21:33:49 +0000 (21:33 +0000)
Under sanityn.sh/16b variable STRIPE_BYTES is used to define
the block size within 'dd' command. However STRIPE_BYTES is
used undefined. This results in 'dd' command failing silently.
Although this does not affect the outcome of the test, the 'dd'
command used this way is no-op.

This patch fixes use of undefined variable under sanityn.sh:16b
by replacing variable STRIPE_BYTES with variable stripe_size.

Test-Parameters: trivial testlist=sanityn
Change-Id: I8bc947d93e339573759d5d37e800aae9bc3b4b18
Signed-off-by: Arshad Hussain <arshad.super@gmail.com>
Reviewed-on: https://review.whamcloud.com/35246
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
lustre/tests/sanityn.sh

index 38b884a..b2f41a7 100755 (executable)
@@ -417,18 +417,21 @@ run_test 16a "$FSXNUM iterations of dual-mount fsx"
 test_16b() {
        local file1=$DIR1/$tfile
        local file2=$DIR2/$tfile
+       local stripe_size=($($LFS getstripe -S $DIR))
 
        # to allocate grant because it may run out due to test_15.
        lfs setstripe -c -1 $file1
-       dd if=/dev/zero of=$file1 bs=$STRIPE_BYTES count=$OSTCOUNT oflag=sync
-       dd if=/dev/zero of=$file2 bs=$STRIPE_BYTES count=$OSTCOUNT oflag=sync
+       dd if=/dev/zero of=$file1 bs=$stripe_size count=$OSTCOUNT oflag=sync ||
+               error "dd failed writing to file=$file1"
+       dd if=/dev/zero of=$file2 bs=$stripe_size count=$OSTCOUNT oflag=sync ||
+               error "dd failed writing to file=$file2"
        rm -f $file1
 
        lfs setstripe -c -1 $file1 # b=10919
        # -o is set to 8192 because writes < 1 page and between 1 and 2 pages
        # create a mix of tiny writes & normal writes
        fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -o 8192 -S 0 $file1 \
-       $file2
+       $file2 || error "fsx with tiny write failed."
 }
 run_test 16b "$FSXNUM iterations of dual-mount fsx at small size"