Home | History | Annotate | Download | only in f_convert_bmap_and_extent
      1 if [ "$DESCRIPTION"x != x ]; then
      2 	test_description="$DESCRIPTION"
      3 fi
      4 if [ "$IMAGE"x = x ]; then
      5 	IMAGE=$test_dir/image.gz
      6 fi
      7 
      8 if [ "$FSCK_OPT"x = x ]; then
      9 	FSCK_OPT=-yf
     10 fi
     11 
     12 if [ "$SECOND_FSCK_OPT"x = x ]; then
     13 	SECOND_FSCK_OPT=-yf
     14 fi
     15 
     16 if [ "$OUT1"x = x ]; then
     17 	OUT1=$test_name.1.log
     18 fi
     19 
     20 if [ "$OUT2"x = x ]; then
     21 	OUT2=$test_name.2.log
     22 fi
     23 
     24 if [ "$EXP1"x = x ]; then
     25 	if [ -f $test_dir/expect.1.gz ]; then
     26 		EXP1=$test_name.1.tmp
     27 		gunzip < $test_dir/expect.1.gz > $EXP1
     28 	else
     29 		EXP1=$test_dir/expect.1
     30 	fi
     31 fi
     32 
     33 if [ "$EXP2"x = x ]; then
     34 	if [ -f $test_dir/expect.2.gz ]; then
     35 		EXP2=$test_name.2.tmp
     36 		gunzip < $test_dir/expect.2.gz > $EXP2
     37 	else
     38 		EXP2=$test_dir/expect.2
     39 	fi
     40 fi
     41 
     42 if [ "$SKIP_GUNZIP" != "true" ] ; then
     43 	gunzip < $IMAGE > $TMPFILE
     44 fi
     45 
     46 cp /dev/null $OUT1
     47 
     48 eval $PREP_CMD
     49 
     50 echo 'stat /a' > $TMPFILE.cmd
     51 echo 'ex /zero' >> $TMPFILE.cmd
     52 $DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
     53 rm -rf $TMPFILE.cmd
     54 $TUNE2FS -O extent $TMPFILE >> $OUT1.new 2>&1
     55 $FSCK $FSCK_OPT -E bmap2extent -N test_filesys $TMPFILE >> $OUT1.new 2>&1
     56 status=$?
     57 echo Exit status is $status >> $OUT1.new
     58 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
     59 rm -f $OUT1.new
     60 
     61 $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 
     62 status=$?
     63 echo Exit status is $status >> $OUT2.new
     64 echo 'ex /a' > $TMPFILE.cmd
     65 echo 'ex /zero' >> $TMPFILE.cmd
     66 $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
     67 rm -rf $TMPFILE.cmd
     68 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
     69 rm -f $OUT2.new
     70 
     71 eval $AFTER_CMD
     72 
     73 if [ "$SKIP_VERIFY" != "true" ] ; then
     74 	rm -f $test_name.ok $test_name.failed
     75 	cmp -s $OUT1 $EXP1
     76 	status1=$?
     77 	if [ "$ONE_PASS_ONLY" != "true" ]; then
     78 		cmp -s $OUT2 $EXP2
     79 		status2=$?
     80 	else
     81 		status2=0
     82 	fi
     83 	if [ "$PASS_ZERO" = "true" ]; then
     84 		cmp -s $test_name.0.log	$test_dir/expect.0
     85 		status3=$?
     86 	else
     87 		status3=0
     88 	fi
     89 
     90 	if [ -z "$test_description" ] ; then
     91 		description="$test_name"
     92 	else
     93 		description="$test_name: $test_description"
     94 	fi
     95 
     96 	if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
     97 		echo "$description: ok"
     98 		touch $test_name.ok
     99 	else
    100 		echo "$description: failed"
    101 		rm -f $test_name.failed
    102 		if [ "$PASS_ZERO" = "true" ]; then
    103 			diff $DIFF_OPTS $test_dir/expect.0 \
    104 				$test_name.0.log >> $test_name.failed
    105 		fi
    106 		diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
    107 		if [ "$ONE_PASS_ONLY" != "true" ]; then
    108 			diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
    109 		fi
    110 	fi
    111 	rm -f tmp_expect
    112 fi
    113 
    114 if [ "$SKIP_CLEANUP" != "true" ] ; then
    115 	unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 
    116 	unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
    117 	unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
    118 fi
    119 
    120