Whamcloud - gitweb
tests: don't run sed multiple times on test output
[tools/e2fsprogs.git] / tests / j_long_trans_mcsum_32bit / script
1 if ! test -x $DEBUGFS_EXE; then
2         echo "$test_name: $test_description: skipped (no debugfs)"
3         return 0
4 fi
5
6 FSCK_OPT=-fy
7 OUT=$test_name.log
8 if [ -f $test_dir/expect.gz ]; then
9         EXP=$test_name.tmp
10         gunzip < $test_dir/expect.gz > $EXP1
11 else
12         EXP=$test_dir/expect
13 fi
14
15 $MKE2FS -F -o Linux -b 1024 -O ^64bit,has_journal,metadata_csum -T ext4 $TMPFILE 524288 > $OUT.new 2>&1
16
17 $FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
18 status=$?
19 echo Exit status is $status >> $OUT.new
20
21 $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT.new
22
23 echo "debugfs write journal" >> $OUT.new
24 echo "jo -c" > $TMPFILE.cmd
25 echo "jw -b 260-4356 /dev/zero" >> $TMPFILE.cmd
26 echo "jc" >> $TMPFILE.cmd
27 $DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
28
29 $DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT.new
30
31 test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
32 echo "logdump -c" > $TMPFILE.cmd
33 $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1
34
35 $FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
36 status=$?
37 echo Exit status is $status >> $OUT.new
38 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT
39 rm -f $TMPFILE $TMPFILE.cmd $OUT.new
40
41 cmp -s $OUT $EXP
42 status=$?
43
44 if [ "$status" = 0 ] ; then
45         echo "$test_name: $test_description: ok"
46         touch $test_name.ok
47 else
48         echo "$test_name: $test_description: failed"
49         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
50         rm -f $test_name.tmp
51 fi
52
53 unset IMAGE FSCK_OPT OUT EXP