• 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 64bit,has_journal,metadata_csum -T ext4 $TMPFILE 524288 > $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
21$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT.new
22
23echo "debugfs write journal" >> $OUT.new
24echo "jo -c" > $TMPFILE.cmd
25echo "jw -b 262-4358 /dev/zero" >> $TMPFILE.cmd
26echo "jc" >> $TMPFILE.cmd
27echo "jo" >> $TMPFILE.cmd
28echo "jw -r 262-4358" >> $TMPFILE.cmd
29echo "jc" >> $TMPFILE.cmd
30$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
31
32$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT.new
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 -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1
37
38$FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
39status=$?
40echo Exit status is $status >> $OUT.new
41sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT
42rm -f $TMPFILE $TMPFILE.cmd $OUT.new
43
44cmp -s $OUT $EXP
45status=$?
46
47if [ "$status" = 0 ] ; then
48	echo "$test_name: $test_description: ok"
49	touch $test_name.ok
50else
51	echo "$test_name: $test_description: failed"
52	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
53	rm -f $test_name.tmp
54fi
55
56unset IMAGE FSCK_OPT OUT EXP
57