• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1if ! test -x $DEBUGFS_EXE; then
2	echo "$test_name: $test_description: skipped (no debugfs)"
3	return 0
4fi
5
6FSCK_OPT=-fy
7OUT=$test_name.log
8if [ -f $test_dir/expect.gz ]; then
9	EXP=$test_name.tmp
10	gunzip < $test_dir/expect.gz > $EXP1
11else
12	EXP=$test_dir/expect
13fi
14
15$MKE2FS -F -o Linux -b 1024 -O has_journal -T ext4 $TMPFILE 262144 > $OUT.new 2>&1
16
17$FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
18status=$?
19echo Exit status is $status >> $OUT.new
20
21echo "debugfs write journal" >> $OUT.new
22echo "jo" > $TMPFILE.cmd
23echo "jw -b 259-4356 /dev/zero" >> $TMPFILE.cmd
24echo "jc" >> $TMPFILE.cmd
25echo "jo" >> $TMPFILE.cmd
26echo "jw -r 259-4356" >> $TMPFILE.cmd
27echo "jc" >> $TMPFILE.cmd
28$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
29
30test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
31echo "logdump -c" > $TMPFILE.cmd
32$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1
33
34$FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
35status=$?
36echo Exit status is $status >> $OUT.new
37sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT
38rm -f $TMPFILE $TMPFILE.cmd $OUT.new
39
40cmp -s $OUT $EXP
41status=$?
42
43if [ "$status" = 0 ] ; then
44	echo "$test_name: $test_description: ok"
45	touch $test_name.ok
46else
47	echo "$test_name: $test_description: failed"
48	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
49	rm -f $test_name.tmp
50fi
51
52unset IMAGE FSCK_OPT OUT EXP
53