From b3354c9bb3b7225a62519a644c7a5f1595aa4f8a Mon Sep 17 00:00:00 2001 From: grev Date: Wed, 25 Feb 2009 11:24:13 +0000 Subject: [PATCH] b=18514 i=Adilger test_170: check that log files were created --- lustre/tests/sanity.sh | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 40def8b..2b7f1f0 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -5699,31 +5699,41 @@ test_153() { } run_test 153 "test if fdatasync does not crash =======================" -test_160() { +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 @@ -5737,7 +5747,7 @@ test_160() { fi true } -run_test 160 "test lctl df to handle corruputed log =====================" +run_test 170 "test lctl df to handle corrupted log =====================" POOL=${POOL:-cea1} -- 1.8.3.1