1if test -x $RESIZE2FS_EXE; then
2
3FSCK_OPT=-yf
4OUT=$test_name.log
5if [ -f $test_dir/expect.gz ]; then
6	EXP=tmp_expect
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 resize_inode -o Linux -b 1024 -g 1024 test.img 16384 > $OUT
17$MKE2FS -q -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 16384 2>&1 \
18	| sed -e '1d' | grep -v "automatically checked" | 
19	grep -v "whichever comes first" >> $OUT 
20
21echo resize2fs test.img 65536 >> $OUT
22$RESIZE2FS $TMPFILE 65536 2>&1 | sed -e '1d' >> $OUT
23
24$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
25status=$?
26echo Exit status is $status >> $OUT.new
27sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d'  | tr -d \\015 >> $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_dumpe2fs >> $OUT
37
38echo "--------------------------------" >> $OUT
39
40echo mke2fs -q -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 65536 >> $OUT
41$MKE2FS -q -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 65536 2>&1 \
42	| sed -e '1d' | grep -v "automatically checked" | 
43	grep -v "whichever comes first" >> $OUT 
44
45echo resize2fs test.img 16384 >> $OUT
46$RESIZE2FS $TMPFILE 16384 2>&1 | sed -e '1d' >> $OUT
47
48$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
49status=$?
50echo Exit status is $status >> $OUT.new
51sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d'  | tr -d \\015 >> $OUT
52rm -f $OUT.new
53
54$DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1
55$DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1
56$DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1
57$TUNE2FS -c 20 -U clear $TMPFILE  >/dev/null 2>&1
58
59echo dumpe2fs test.img >> $OUT
60$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter_dumpe2fs >> $OUT
61
62echo "--------------------------------" >> $OUT
63
64echo resize2fs test.img 165536 >> $OUT
65$RESIZE2FS $TMPFILE 165536 2>&1 | sed -e '1d' >> $OUT
66
67$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
68status=$?
69echo Exit status is $status >> $OUT.new
70sed -e '1d' $OUT.new | sed -e '/^JFS DEBUG:/d'  | tr -d \\015 >> $OUT
71rm -f $OUT.new
72
73$DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1
74$DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1
75$DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1
76$TUNE2FS -c 20 -U clear $TMPFILE  >/dev/null 2>&1
77
78echo dumpe2fs test.img >> $OUT
79$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter_dumpe2fs >> $OUT
80
81rm -f $test_name.ok $test_name.failed $TMPFILE
82cmp -s $OUT $EXP
83status=$?
84
85if [ "$status" = 0 ] ; then
86	echo "ok"
87	touch $test_name.ok
88else
89	echo "failed"
90	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
91	rm -f tmp_expect
92fi
93
94unset IMAGE FSCK_OPT OUT EXP
95
96else #if test -x $RESIZE2FS; then
97	rm -f $test_name.ok $test_name.failed
98	echo "skipped"
99fi 
100