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 4096 -O 64bit,has_journal,metadata_csum -T ext4 $TMPFILE 131072 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
22bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')"
23
24$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT
25
26echo "debugfs write journal" >> $OUT
27echo "jo -c" > $TMPFILE.cmd
28echo "jw -b $bitmaps /dev/zero -c" >> $TMPFILE.cmd
29echo "jc" >> $TMPFILE.cmd
30$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
31sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
32rm -rf $OUT.new
33
34$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT
35
36test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
37echo "logdump -c" > $TMPFILE.cmd
38$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
39rm -rf $TMPFILE.cmd
40
41$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
42status=$?
43echo Exit status is $status >> $OUT.new
44sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
45rm -f $OUT.new
46
47rm -f $TMPFILE
48
49cmp -s $OUT $EXP
50status=$?
51
52if [ "$status" = 0 ] ; then
53	echo "$test_name: $test_description: ok"
54	touch $test_name.ok
55else
56	echo "$test_name: $test_description: failed"
57	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
58	rm -f $test_name.tmp
59fi
60
61unset IMAGE FSCK_OPT OUT EXP
62
63else #if test -x $DEBUGFS_EXE; then
64	echo "$test_name: $test_description: skipped"
65fi
66