X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Fsanity.sh;h=6aadd4f7da555f1337eb1b992ca629f307519852;hp=ec0094777356b2a31b22b64c84ee971f4bb05f8a;hb=e99b9dfa326292514eae0dbf4a96b3fb3855dceb;hpb=a2653d9231cc72e8875e6fa250cc4b94904fa300 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index ec00947..6aadd4f 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -6118,27 +6118,37 @@ test_170() { $LCTL debug_daemon start $TMP/${tfile}_log_good touch $DIR/$tfile $LCTL debug_daemon stop - cat $TMP/${tfile}_log_good | sed -e "s/^...../a/g" > $TMP/${tfile}_log_bad + sed -e "s/^...../a/g" $TMP/${tfile}_log_good > $TMP/${tfile}_log_bad || + error "sed failed to read log_good" $LCTL debug_daemon start $TMP/${tfile}_log_good rm -rf $DIR/$tfile $LCTL debug_daemon stop - $LCTL df $TMP/${tfile}_log_bad 2&> $TMP/${tfile}_log_bad.out - bad_line=`tail -n 1 $TMP/${tfile}_log_bad.out | awk '{print $9}'` - good_line1=`tail -n 1 $TMP/${tfile}_log_bad.out | awk '{print $5}'` + $LCTL df $TMP/${tfile}_log_bad 2&> $TMP/${tfile}_log_bad.out || + error "lctl df log_bad failed" + + local bad_line=$(tail -n 1 $TMP/${tfile}_log_bad.out | awk '{print $9}') + local good_line1=$(tail -n 1 $TMP/${tfile}_log_bad.out | awk '{print $5}') $LCTL df $TMP/${tfile}_log_good 2&>$TMP/${tfile}_log_good.out - good_line2=`tail -n 1 $TMP/${tfile}_log_good.out | awk '{print $5}'` + local good_line2=$(tail -n 1 $TMP/${tfile}_log_good.out | awk '{print $5}') + [ "$bad_line" ] && [ "$good_line1" ] && [ "$good_line2" ] || + error "bad_line good_line1 good_line2 are empty" + cat $TMP/${tfile}_log_good >> $TMP/${tfile}_logs_corrupt cat $TMP/${tfile}_log_bad >> $TMP/${tfile}_logs_corrupt cat $TMP/${tfile}_log_good >> $TMP/${tfile}_logs_corrupt $LCTL df $TMP/${tfile}_logs_corrupt 2&> $TMP/${tfile}_log_bad.out - bad_line_new=`tail -n 1 $TMP/${tfile}_log_bad.out | awk '{print $9}'` - good_line_new=`tail -n 1 $TMP/${tfile}_log_bad.out | awk '{print $5}'` - expected_good=$((good_line1 + good_line2*2)) + local bad_line_new=$(tail -n 1 $TMP/${tfile}_log_bad.out | awk '{print $9}') + local good_line_new=$(tail -n 1 $TMP/${tfile}_log_bad.out | awk '{print $5}') + + [ "$bad_line_new" ] && [ "$good_line_new" ] || + error "bad_line_new good_line_new are empty" + + local expected_good=$((good_line1 + good_line2*2)) rm -rf $TMP/${tfile}* if [ $bad_line -ne $bad_line_new ]; then @@ -6152,7 +6162,7 @@ test_170() { fi true } -run_test 170 "test lctl df to handle corruputed log =====================" +run_test 170 "test lctl df to handle corrupted log =====================" # OST pools tests POOL=${POOL:-cea1}