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