From: Bruno Faccini Date: Fri, 19 Dec 2014 22:42:05 +0000 (+0100) Subject: LU-6056 tests: fix -hsm wrong usage of bash's local built-in X-Git-Tag: 2.6.93~84 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=37145b39ecc2bd78e669f962ec6cfe7cebb06c5c;hp=dd084b62170ecb59add9ab571c0352b66bb276bd LU-6056 tests: fix -hsm wrong usage of bash's local built-in In sanity-hsm test script, there were several places where the bash's local built-in was used with assignments from a command substitution and command's exit code was tested after. This is a wrong usage since the 'local' builtin does not propagate the exit code. Signed-off-by: Bruno Faccini Change-Id: I4257e55ec61ed0c4e48812407b5cf82ab316b701 Reviewed-on: http://review.whamcloud.com/13159 Tested-by: Jenkins Reviewed-by: John L. Hammond Tested-by: Maloo Reviewed-by: James Nunez Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 68a496c..28a8d02 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -517,12 +517,13 @@ path2fid() { get_hsm_flags() { local f=$1 local u=$2 + local st if [[ $u == "user" ]]; then - local st=$($RUNAS $LFS hsm_state $f) + st=$($RUNAS $LFS hsm_state $f) else - local st=$($LFS hsm_state $f) u=root + st=$($LFS hsm_state $f) fi [[ $? == 0 ]] || error "$LFS hsm_state $f failed (run as $u)" @@ -533,7 +534,8 @@ get_hsm_flags() { get_hsm_archive_id() { local f=$1 - local st=$($LFS hsm_state $f) + local st + st=$($LFS hsm_state $f) [[ $? == 0 ]] || error "$LFS hsm_state $f failed" local ar=$(echo $st | grep "archive_id" | cut -f5 -d" " | @@ -1153,7 +1155,8 @@ test_12c() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile $LFS setstripe -c 2 $f - local fid=$(make_large_for_striping $f) + local fid + fid=$(make_large_for_striping $f) [ $? != 0 ] && skip "not enough free space" && return local FILE_CRC=$(md5sum $f) @@ -2030,7 +2033,8 @@ test_26() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f @@ -2069,7 +2073,8 @@ test_27b() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f @@ -2090,7 +2095,8 @@ test_28() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f @@ -2270,7 +2276,8 @@ test_31b() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f @@ -2293,7 +2300,8 @@ test_31c() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress_aligned $f) + local fid + fid=$(make_large_for_progress_aligned $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f @@ -2316,7 +2324,8 @@ test_33() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f @@ -2382,7 +2391,8 @@ test_34() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f @@ -2417,7 +2427,8 @@ test_35() { local f=$DIR/$tdir/$tfile local f1=$DIR/$tdir/$tfile-1 - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return local fid1=$(copy_file /etc/passwd $f1) @@ -2455,7 +2466,8 @@ test_36() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f @@ -2650,7 +2662,8 @@ test_56() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f || @@ -2773,7 +2786,8 @@ test_60() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return local mdtidx=0 @@ -2881,7 +2895,8 @@ test_71() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f || @@ -3158,7 +3173,8 @@ test_104() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return # if cdt is on, it can serve too quickly the request @@ -3471,7 +3487,8 @@ test_200() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_cancel $f) + local fid + fid=$(make_large_for_cancel $f) [ $? != 0 ] && skip "not enough free space" && return # test with cdt on is made in test_221 @@ -3514,7 +3531,8 @@ test_202() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $f @@ -3561,7 +3579,8 @@ test_221() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_cancel $f) + local fid + fid=$(make_large_for_cancel $f) [ $? != 0 ] && skip "not enough free space" && return changelog_setup @@ -3669,7 +3688,8 @@ test_223b() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return changelog_setup @@ -3730,7 +3750,8 @@ test_225() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_progress $f) + local fid + fid=$(make_large_for_progress $f) [ $? != 0 ] && skip "not enough free space" && return changelog_setup @@ -3934,7 +3955,8 @@ test_251() { mkdir -p $DIR/$tdir local f=$DIR/$tdir/$tfile - local fid=$(make_large_for_cancel $f) + local fid + fid=$(make_large_for_cancel $f) [ $? != 0 ] && skip "not enough free space" && return cdt_disable