From: wangdi Date: Tue, 23 Dec 2008 15:51:59 +0000 (+0000) Subject: Branch b1_6 X-Git-Tag: GIT_EPOCH_B1_6~2^5~274 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=791ad1112f905ed62baae90f92cd29f18339b086;p=fs%2Flustre-release.git Branch b1_6 b=16117 add test scritpt for 16117 i=adilger, johann --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 49a9dc8..419d148 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -5564,6 +5564,46 @@ run_test 153 "test if fdatasync does not crash =======================" # # tests that do cleanup/setup should be run at the end # +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 + + $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_good 2&>$TMP/${tfile}_log_good.out + good_line2=`tail -n 1 $TMP/${tfile}_log_good.out | awk '{print $5}'` + + 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)) + + rm -rf $TMP/${tfile}* + if [ $bad_line -ne $bad_line_new ]; then + error "expected $bad_line bad lines, but got $bad_line_new" + return 1 + fi + + if [ $expected_good -ne $good_line_new ]; then + error "expected $expected_good good lines, but got $good_line_new" + return 2 + fi + true +} +run_test 170 "test lctl df to handle corruputed log =====================" + test_900() { local ls