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