• 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 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 333,$bitmaps /dev/zero" >> $TMPFILE.cmd
29echo "jc" >> $TMPFILE.cmd
30echo "jo" >> $TMPFILE.cmd
31echo "jw -r 333" >> $TMPFILE.cmd
32echo "jc" >> $TMPFILE.cmd
33$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
34sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
35rm -rf $OUT.new
36
37$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT
38
39test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
40echo "logdump -c" > $TMPFILE.cmd
41$DEBUGFS_EXE -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
42rm -rf $TMPFILE.cmd
43
44echo "debugfs recover journal" >> $OUT
45echo "jr" > $TMPFILE.cmd
46$DEBUGFS_EXE -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
47sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
48rm -rf $OUT.new
49
50$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
51status=$?
52echo Exit status is $status >> $OUT.new
53sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
54rm -f $OUT.new
55
56rm -f $TMPFILE $TMPFILE.cmd
57
58cmp -s $OUT $EXP
59status=$?
60
61if [ "$status" = 0 ] ; then
62	echo "$test_name: $test_description: ok"
63	touch $test_name.ok
64else
65	echo "$test_name: $test_description: failed"
66	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
67	rm -f $test_name.tmp
68fi
69
70unset IMAGE FSCK_OPT OUT EXP
71
72else #if test -x $DEBUGFS_EXE; then
73	echo "$test_name: $test_description: skipped"
74fi
75