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