X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=tests%2Frun_e2fsck;h=1a39a8995db91df3a656b34fdd2ece19c1622b0b;hb=ed32da62da612a7fb8ad4fe0ebab7f97f604491b;hp=91277e1915d7cdb6733022ab9514a98ccbcab3c0;hpb=1e3472c5f37ca3686dd69b079d4d02a302f5798d;p=tools%2Fe2fsprogs.git diff --git a/tests/run_e2fsck b/tests/run_e2fsck index 91277e1..1a39a89 100644 --- a/tests/run_e2fsck +++ b/tests/run_e2fsck @@ -1,3 +1,6 @@ +if [ "$DESCRIPTION"x != x ]; then + test_description="$DESCRIPTION" +fi if [ "$IMAGE"x = x ]; then IMAGE=$test_dir/image.gz fi @@ -19,30 +22,50 @@ if [ "$OUT2"x = x ]; then fi if [ "$EXP1"x = x ]; then - EXP1=$test_dir/expect.1 + if [ -f $test_dir/expect.1.gz ]; then + EXP1=$test_name.1.tmp + gunzip < $test_dir/expect.1.gz > $EXP1 + else + EXP1=$test_dir/expect.1 + [ "$CHECK_RHEL7" = "true" -a -f $test_dir/expect_rhel7.1 ] && + EXP1=$test_dir/expect_rhel7.1 || true + fi fi if [ "$EXP2"x = x ]; then - EXP2=$test_dir/expect.2 + if [ -f $test_dir/expect.2.gz ]; then + EXP2=$test_name.2.tmp + gunzip < $test_dir/expect.2.gz > $EXP2 + else + EXP2=$test_dir/expect.2 + [ "$CHECK_RHEL7" = "true" -a -f $test_dir/expect_rhel7.2 ] && + EXP2=$test_dir/expect_rhel7.2 || true + fi +fi + +if [ "$SKIP_GUNZIP" != "true" ] ; then + gunzip < $IMAGE > $TMPFILE fi -gunzip < $IMAGE > $TMPFILE +cp /dev/null $OUT1 -$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT1.new 2>&1 +eval $PREP_CMD + +$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT1.new 2>&1 status=$? echo Exit status is $status >> $OUT1.new -sed -e '1d' $OUT1.new > $OUT1 +sed -f $cmd_dir/filter.sed $OUT1.new >> $OUT1 rm -f $OUT1.new if [ "$ONE_PASS_ONLY" != "true" ]; then $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 status=$? echo Exit status is $status >> $OUT2.new - sed -e '1d' $OUT2.new > $OUT2 + sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 rm -f $OUT2.new fi -rm $TMPFILE +eval $AFTER_CMD if [ "$SKIP_VERIFY" != "true" ] ; then rm -f $test_name.ok $test_name.failed @@ -54,20 +77,40 @@ if [ "$SKIP_VERIFY" != "true" ] ; then else status2=0 fi + if [ "$PASS_ZERO" = "true" ]; then + cmp -s $test_name.0.log $test_dir/expect.0 + status3=$? + else + status3=0 + fi - if [ "$status1" = 0 -a "$status2" = 0 ] ; then - echo "ok" + if [ -z "$test_description" ] ; then + description="$test_name" + else + description="$test_name: $test_description" + fi + + if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then + echo "$description: ok" touch $test_name.ok else - echo "failed" - diff -c $EXP1 $OUT1 > $test_name.failed + echo "$description: failed" + rm -f $test_name.failed + if [ "$PASS_ZERO" = "true" ]; then + diff $DIFF_OPTS $test_dir/expect.0 \ + $test_name.0.log >> $test_name.failed + fi + diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed if [ "$ONE_PASS_ONLY" != "true" ]; then - diff -c $EXP2 $OUT2 >> $test_name.failed + diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed fi fi + rm -f tmp_expect fi if [ "$SKIP_CLEANUP" != "true" ] ; then - unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 ONE_PASS_ONLY + unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 + unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD + unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO fi