Whamcloud - gitweb
tests: don't run sed multiple times on test output
[tools/e2fsprogs.git] / tests / i_bad_csum / script
1 test_description="e2image corrupt fs"
2
3 IMAGE=$test_dir/image.gz
4 OUT=$test_name.log
5 EXP=$test_dir/expect
6
7 gzip -d < $IMAGE > $TMPFILE
8 $E2IMAGE -r $TMPFILE $TMPFILE.bin > $OUT 2>&1
9 $FSCK -fn $TMPFILE.bin >> $OUT 2>&1
10
11 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test_filesys;" $OUT > $OUT.new
12 mv $OUT.new $OUT
13
14 cmp -s $OUT $EXP
15 status=$?
16 if [ "$status" = 0 ] ; then
17         echo "$test_name: $test_description: ok"
18         touch $test_name.ok
19 else
20         echo "$test_name: $test_description: failed"
21         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
22         rm -f $test_name.tmp
23 fi
24
25 rm -f $OUT $TMPFILE $TMPFILE.bin $TMPFILE.test
26 unset IMAGE FSCK_OPT OUT EXP