script revision f9fd342e568dbadaadbb0b242f14271cb384c38b
1if test -x $DEBUGFS_EXE; then
2
3test_description="e2fsck with resize_inode"
4FSCK_OPT=-yf
5OUT=$test_name.log
6if [ -f $test_dir/expect.gz ]; then
7	EXP=$test_name.tmp
8	gunzip < $test_dir/expect.gz > $EXP1
9else
10	EXP=$test_dir/expect
11fi
12
13cp /dev/null $OUT
14
15dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
16
17echo mke2fs -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384 > $OUT
18$MKE2FS -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 16384 2>&1 |
19	sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT
20
21$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
22status=$?
23echo Exit status is $status >> $OUT.new
24sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
25rm -f $OUT.new
26
27echo ----------------------------------------------- >> $OUT
28
29echo " " >> $OUT
30echo "debugfs -R ''set_inode_field <7> block[2] 42'' -w test.img" > $OUT.new
31$DEBUGFS -R "set_inode_field <7> block[2] 42" -w $TMPFILE >> $OUT.new 2>&1
32status=$?
33echo Exit status is $status >> $OUT.new
34sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
35
36$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
37status=$?
38echo Exit status is $status >> $OUT.new
39sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
40rm -f $OUT.new
41
42$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
43status=$?
44echo Exit status is $status >> $OUT.new
45sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
46rm -f $OUT.new
47
48echo ----------------------------------------------- >> $OUT
49
50echo " " >> $OUT
51echo "debugfs -R ''clri <7>'' -w test.img" > $OUT.new
52$DEBUGFS -R "clri <7>" -w $TMPFILE >> $OUT.new 2>&1
53status=$?
54echo Exit status is $status >> $OUT.new
55sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
56
57$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
58status=$?
59echo Exit status is $status >> $OUT.new
60sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
61rm -f $OUT.new
62
63$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
64status=$?
65echo Exit status is $status >> $OUT.new
66sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
67rm -f $OUT.new
68
69echo ----------------------------------------------- >> $OUT
70
71echo " " >> $OUT
72echo "debugfs -R ''set_inode_field <7> bmap[524] 57'' -w test.img" > $OUT.new
73$DEBUGFS -R "set_inode_field <7> bmap[524] 57" -w $TMPFILE >> $OUT.new 2>&1
74status=$?
75echo Exit status is $status >> $OUT.new
76sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
77
78$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
79status=$?
80echo Exit status is $status >> $OUT.new
81sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
82rm -f $OUT.new
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 $OUT.new >> $OUT
88rm -f $OUT.new
89
90echo ----------------------------------------------- >> $OUT
91
92echo " " >> $OUT
93echo "debugfs -R ''set_super_value reserved_gdt_blocks 15679'' -w test.img" > $OUT.new
94$DEBUGFS -R "set_super_value reserved_gdt_blocks 15679" -w $TMPFILE >> $OUT.new 2>&1
95status=$?
96echo Exit status is $status >> $OUT.new
97sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
98
99$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
100status=$?
101echo Exit status is $status >> $OUT.new
102sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
103rm -f $OUT.new
104
105echo ----------------------------------------------- >> $OUT
106
107echo " " >> $OUT
108echo "debugfs -R ''set_super_value reserved_gdt_blocks 32'' -w test.img" > $OUT.new
109$DEBUGFS -R "set_super_value reserved_gdt_blocks 32" -w $TMPFILE >> $OUT.new 2>&1
110status=$?
111echo Exit status is $status >> $OUT.new
112sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
113
114$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
115status=$?
116echo Exit status is $status >> $OUT.new
117sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
118rm -f $OUT.new
119
120$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
121status=$?
122echo Exit status is $status >> $OUT.new
123sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
124rm -f $OUT.new
125
126
127cmp -s $OUT $EXP
128status=$?
129
130if [ "$status" = 0 ] ; then
131	echo "$test_name: $test_description: ok"
132	touch $test_name.ok
133else
134	echo "$test_name: $test_description: failed"
135	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
136	rm -f tmp_expect
137fi
138
139unset IMAGE FSCK_OPT OUT EXP
140
141else #if test -x $DEBUGFS_EXE; then
142	echo "$test_name: $test_description: skipped"
143fi 
144