1if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
2
3FSCK_OPT=-yf
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
14dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
15
16echo mke2fs -q -F -o Linux -b 1024 -g 256 test.img 1024 > $OUT
17$MKE2FS -q -F -o Linux -b 1024 -g 256 $TMPFILE 1024 2>&1 |
18	sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT
19
20echo resize2fs -p test.img 10000 >> $OUT
21$RESIZE2FS -p $TMPFILE 10000 2>&1 |
22	sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT
23
24$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
25status=$?
26echo Exit status is $status >> $OUT.new
27sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
28rm -f $OUT.new
29
30$DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1
31$DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1
32$DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1
33$TUNE2FS -c 20 -U clear $TMPFILE  >/dev/null 2>&1
34
35echo dumpe2fs test.img >> $OUT
36$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
37
38echo "--------------------------------" >> $OUT
39
40echo resize2fs -p test.img 20000 >> $OUT
41$RESIZE2FS -p $TMPFILE 20000 2>&1 |
42	sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT
43
44$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
45status=$?
46echo Exit status is $status >> $OUT.new
47sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
48rm -f $OUT.new
49
50$DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1
51$DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1
52$DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1
53$TUNE2FS -c 20 -U clear $TMPFILE  >/dev/null 2>&1
54
55echo dumpe2fs test.img >> $OUT
56$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
57
58echo "--------------------------------" >> $OUT
59
60echo resize2fs -p test.img 30000 >> $OUT
61$RESIZE2FS -p $TMPFILE 30000 2>&1 |
62	sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT
63
64$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
65status=$?
66echo Exit status is $status >> $OUT.new
67sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
68rm -f $OUT.new
69
70$DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1
71$DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1
72$DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1
73$TUNE2FS -c 20 -U clear $TMPFILE  >/dev/null 2>&1
74
75echo dumpe2fs test.img >> $OUT
76$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
77
78echo "--------------------------------" >> $OUT
79
80echo resize2fs -p test.img 40000 >> $OUT
81$RESIZE2FS -p $TMPFILE 40000 2>&1 |
82	sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT
83
84$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
85status=$?
86echo Exit status is $status >> $OUT.new
87sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
88rm -f $OUT.new
89
90$DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1
91$DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1
92$DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1
93$TUNE2FS -c 20 -U clear $TMPFILE  >/dev/null 2>&1
94
95echo dumpe2fs test.img >> $OUT
96$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
97
98rm -f $TMPFILE
99
100cmp -s $OUT $EXP
101status=$?
102
103if [ "$status" = 0 ] ; then
104	echo "$test_name: $test_description: ok"
105	touch $test_name.ok
106else
107	echo "$test_name: $test_description: failed"
108	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
109	rm -f $test_name.tmp
110fi
111
112unset IMAGE FSCK_OPT OUT EXP
113
114else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
115	echo "$test_name: $test_description: skipped"
116fi
117