From 9b2087bc3de26426727aa81a58fce556db3a2ac5 Mon Sep 17 00:00:00 2001 From: kalpak Date: Sat, 13 Dec 2008 13:06:16 +0000 Subject: [PATCH] b=17898 i=adilger i=grev reset IFS to original value in test_130 --- lustre/tests/sanity.sh | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index a759606..f35c987 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -5283,10 +5283,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 has no FIEMAP support" && 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" @@ -5306,6 +5314,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 @@ -5313,9 +5322,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)" @@ -5326,6 +5339,8 @@ test_130b() { filefrag_op=$(filefrag -e 2>&1 | grep "invalid option") [ -n "$filefrag_op" ] && skip "filefrag has no FIEMAP support" && 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" @@ -5345,6 +5360,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 $fm_file: len $tot_len for OST $last_lun instead of 256" return else @@ -5356,10 +5372,13 @@ test_130b() { last_lun=$frag_lun done if (( num_luns != 2 || tot_len != 1024 )); then + cleanup_130 error "FIEMAP $fm_file: 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)" @@ -5370,6 +5389,8 @@ test_130c() { filefrag_op=$(filefrag -e 2>&1 | grep "invalid option") [ -n "$filefrag_op" ] && skip "filefrag has no FIEMAP support" && 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" @@ -5391,10 +5412,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 $fm_file: logical start for LUN $logical instead of 512" return fi if (( tot_len != 512 )); then + cleanup_130 error "FIEMAP $fm_file: len $tot_len for OST $last_lun instead of 1024" return else @@ -5406,10 +5429,13 @@ test_130c() { last_lun=$frag_lun done if (( num_luns != 2 || tot_len != 512 )); then + cleanup_130 error "FIEMAP $fm_file: 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)" @@ -5420,6 +5446,8 @@ test_130d() { filefrag_op=$(filefrag -e 2>&1 | grep "invalid option") [ -n "$filefrag_op" ] && skip "filefrag has no FIEMAP support" && 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" @@ -5440,6 +5468,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 $fm_file: len $tot_len for OST $last_lun instead of 1024" return else @@ -5451,10 +5480,13 @@ test_130d() { last_lun=$frag_lun done if (( num_luns != OSTCOUNT || tot_len != 1024 )); then + cleanup_130 error "FIEMAP $fm_file: 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)" @@ -5488,6 +5520,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 $fm_file: len $tot_len for OST $last_lun instead of $EXPECTED_LEN" return else @@ -5499,11 +5532,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 $fm_file: 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