• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 has_journal -T ext4 $TMPFILE 65536 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
24echo "debugfs write journal" >> $OUT
25echo "jo" > $TMPFILE.cmd
26echo "jw -b $bitmaps /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
32test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
33echo "logdump -c" > $TMPFILE.cmd
34$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
35rm -rf $TMPFILE.cmd
36
37echo "debugfs can't recover open journal" >> $OUT
38echo "jo" > $TMPFILE.cmd
39echo "jr" >> $TMPFILE.cmd
40echo "jc" >> $TMPFILE.cmd
41$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE > $OUT.new 2>&1
42sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
43rm -rf $OUT.new
44
45$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
46status=$?
47echo Exit status is $status >> $OUT.new
48sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
49rm -f $OUT.new
50
51rm -f $TMPFILE $TMPFILE.cmd
52
53cmp -s $OUT $EXP
54status=$?
55
56if [ "$status" = 0 ] ; then
57	echo "$test_name: $test_description: ok"
58	touch $test_name.ok
59else
60	echo "$test_name: $test_description: failed"
61	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
62	rm -f $test_name.tmp
63fi
64
65unset IMAGE FSCK_OPT OUT EXP
66
67else #if test -x $DEBUGFS_EXE; then
68	echo "$test_name: $test_description: skipped"
69fi
70