From efb1369e1cd9a9dd444e12c928b5b47ef5fe0538 Mon Sep 17 00:00:00 2001 From: kalpak Date: Sat, 13 Dec 2008 13:05:42 +0000 Subject: [PATCH] b=17898 i=adilger i=grev reset IFS to original value in test_130 --- lustre/tests/sanity.sh | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 77157c2..70b7903 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -5442,10 +5442,18 @@ test_129() { } run_test 129 "test directory size limit ========================" +OLDIFS="$IFS" +cleanup_130() { + trap 0 + IFS="$OLDIFS" +} + test_130a() { filefrag_op=$(filefrag -e 2>&1 | grep "invalid option") [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" && return + trap cleanup_130 EXIT RETURN + local fm_file=$DIR/$tfile lfs setstripe -s 65536 -c 1 $fm_file || error "setstripe failed on $fm_file" dd if=/dev/zero of=$fm_file bs=65536 count=1 || error "dd failed for $fm_file" @@ -5463,6 +5471,7 @@ test_130a() { frag_lun=`echo $line | cut -d: -f5` ext_len=`echo $line | cut -d: -f4` if (( $frag_lun != $lun )); then + cleanup_130 error "FIEMAP on 1-stripe file($fm_file) failed" return fi @@ -5470,9 +5479,13 @@ test_130a() { done if (( lun != frag_lun || start_blk != 0 || tot_len != 64 )); then + cleanup_130 error "FIEMAP on 1-stripe file($fm_file) failed;" return fi + + cleanup_130 + echo "FIEMAP on single striped file succeeded" } run_test 130a "FIEMAP (1-stripe file)" @@ -5483,6 +5496,8 @@ test_130b() { filefrag_op=$(filefrag -e 2>&1 | grep "invalid option") [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" && return + trap cleanup_130 EXIT RETURN + local fm_file=$DIR/$tfile lfs setstripe -s 65536 -c 2 $fm_file || error "setstripe failed on $fm_file" dd if=/dev/zero of=$fm_file bs=1M count=2 || error "dd failed on $fm_file" @@ -5501,6 +5516,7 @@ test_130b() { ext_len=`echo $line | cut -d: -f4` if (( $frag_lun != $last_lun )); then if (( tot_len != 1024 )); then + cleanup_130 error "FIEMAP on $fm_file failed; returned len $tot_len for OST $last_lun instead of 256" return else @@ -5512,10 +5528,13 @@ test_130b() { last_lun=$frag_lun done if (( num_luns != 2 || tot_len != 1024 )); then + cleanup_130 error "FIEMAP on $fm_file failed; returned wrong number of luns or wrong len for OST $last_lun" return fi + cleanup_130 + echo "FIEMAP on 2-stripe file succeeded" } run_test 130b "FIEMAP (2-stripe file)" @@ -5526,6 +5545,8 @@ test_130c() { filefrag_op=$(filefrag -e 2>&1 | grep "invalid option") [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" && return + trap cleanup_130 EXIT RETURN + local fm_file=$DIR/$tfile lfs setstripe -s 65536 -c 2 $fm_file || error "setstripe failed on $fm_file" dd if=/dev/zero of=$fm_file seek=1 bs=1M count=1 || error "dd failed on $fm_file" @@ -5545,10 +5566,12 @@ test_130c() { if (( $frag_lun != $last_lun )); then logical=`echo $line | cut -d: -f2 | cut -d. -f1` if (( logical != 512 )); then + cleanup_130 error "FIEMAP on $fm_file failed; returned logical start for lun $logical instead of 512" return fi if (( tot_len != 512 )); then + cleanup_130 error "FIEMAP on $fm_file failed; returned len $tot_len for OST $last_lun instead of 1024" return else @@ -5560,10 +5583,13 @@ test_130c() { last_lun=$frag_lun done if (( num_luns != 2 || tot_len != 512 )); then + cleanup_130 error "FIEMAP on $fm_file failed; returned wrong number of luns or wrong len for OST $last_lun" return fi + cleanup_130 + echo "FIEMAP on 2-stripe file with hole succeeded" } run_test 130c "FIEMAP (2-stripe file with hole)" @@ -5574,6 +5600,8 @@ test_130d() { filefrag_op=$(filefrag -e 2>&1 | grep "invalid option") [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" && return + trap cleanup_130 EXIT RETURN + local fm_file=$DIR/$tfile lfs setstripe -s 65536 -c $OSTCOUNT $fm_file || error "setstripe failed on $fm_file" dd if=/dev/zero of=$fm_file bs=1M count=$OSTCOUNT || error "dd failed on $fm_file" @@ -5592,6 +5620,7 @@ test_130d() { ext_len=`echo $line | cut -d: -f4` if (( $frag_lun != $last_lun )); then if (( tot_len != 1024 )); then + cleanup_130 error "FIEMAP on $fm_file failed; returned len $tot_len for OST $last_lun instead of 1024" return else @@ -5603,10 +5632,13 @@ test_130d() { last_lun=$frag_lun done if (( num_luns != OSTCOUNT || tot_len != 1024 )); then + cleanup_130 error "FIEMAP on $fm_file failed; returned wrong number of luns or wrong len for OST $last_lun" return fi + cleanup_130 + echo "FIEMAP on N-stripe file succeeded" } run_test 130d "FIEMAP (N-stripe file)" @@ -5617,6 +5649,8 @@ test_130e() { filefrag_op=$(filefrag -e 2>&1 | grep "invalid option") [ -n "$filefrag_op" ] && skip "filefrag does not support FIEMAP" && return + trap cleanup_130 EXIT RETURN + local fm_file=$DIR/$tfile lfs setstripe -s 65536 -c 2 $fm_file || error "setstripe failed on $fm_file" NUM_BLKS=512 @@ -5640,6 +5674,7 @@ test_130e() { ext_len=`echo $line | cut -d: -f4` if (( $frag_lun != $last_lun )); then if (( tot_len != $EXPECTED_LEN )); then + cleanup_130 error "FIEMAP on $fm_file failed; returned len $tot_len for OST $last_lun instead of $EXPECTED_LEN" return else @@ -5651,11 +5686,13 @@ test_130e() { last_lun=$frag_lun done if (( num_luns != 2 || tot_len != $EXPECTED_LEN )); then - echo "$num_luns $tot_len" + cleanup_130 error "FIEMAP on $fm_file failed; returned wrong number of luns or wrong len for OST $last_lun" return fi + cleanup_130 + echo "FIEMAP with continuation calls succeeded" } run_test 130e "FIEMAP (test continuation FIEMAP calls)" -- 1.8.3.1