Whamcloud - gitweb
misc/mke2fs: fix Windows build
[tools/e2fsprogs.git] / tests / f_resize_inode / script
1 test_description="e2fsck with resize_inode"
2 if ! test -x $DEBUGFS_EXE; then
3         echo "$test_name: $test_description: skipped (no debugfs)"
4         return 0
5 fi
6
7 FSCK_OPT=-yf
8 OUT=$test_name.log
9 if [ -f $test_dir/expect.gz ]; then
10         EXP=$test_name.tmp
11         gunzip < $test_dir/expect.gz > $EXP1
12 else
13         EXP=$test_dir/expect
14 fi
15
16 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
17
18 echo mke2fs -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384 > $OUT.new
19 $MKE2FS -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 16384 >> $OUT.new 2>&1
20
21 $FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT.new 2>&1
22 status=$?
23 echo Exit status is $status >> $OUT.new
24
25 echo ----------------------------------------------- >> $OUT.new
26
27 echo " " >> $OUT.new
28 echo "debugfs -R ''set_inode_field <7> block[2] 42'' -w test.img" >> $OUT.new
29 $DEBUGFS -R "set_inode_field <7> block[2] 42" -w $TMPFILE >> $OUT.new 2>&1
30 status=$?
31 echo Exit status is $status >> $OUT.new
32
33 $FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT.new 2>&1
34 status=$?
35 echo Exit status is $status >> $OUT.new
36
37 $FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT.new 2>&1
38 status=$?
39 echo Exit status is $status >> $OUT.new
40
41 echo ----------------------------------------------- >> $OUT.new
42
43 echo " " >> $OUT.new
44 echo "debugfs -R ''clri <7>'' -w test.img" >> $OUT.new
45 $DEBUGFS -R "clri <7>" -w $TMPFILE >> $OUT.new 2>&1
46 status=$?
47 echo Exit status is $status >> $OUT.new
48
49 $FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT.new 2>&1
50 status=$?
51 echo Exit status is $status >> $OUT.new
52
53 $FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT.new 2>&1
54 status=$?
55 echo Exit status is $status >> $OUT.new
56
57 echo ----------------------------------------------- >> $OUT.new
58
59 echo " " >> $OUT.new
60 echo "debugfs -R ''set_inode_field <7> bmap[524] 57'' -w test.img" >> $OUT.new
61 $DEBUGFS -R "set_inode_field <7> bmap[524] 57" -w $TMPFILE >> $OUT.new 2>&1
62 status=$?
63 echo Exit status is $status >> $OUT.new
64
65 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
66 status=$?
67 echo Exit status is $status >> $OUT.new
68
69 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
70 status=$?
71 echo Exit status is $status >> $OUT.new
72
73 echo ----------------------------------------------- >> $OUT.new
74
75 echo " " >> $OUT.new
76 echo "debugfs -R ''set_super_value reserved_gdt_blocks 15679'' -w test.img" >> $OUT.new
77 $DEBUGFS -R "set_super_value reserved_gdt_blocks 15679" -w $TMPFILE >> $OUT.new 2>&1
78 status=$?
79 echo Exit status is $status >> $OUT.new
80
81 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
82 status=$?
83 echo Exit status is $status >> $OUT.new
84
85 echo ----------------------------------------------- >> $OUT.new
86
87 echo " " >> $OUT.new
88 echo "debugfs -R ''set_super_value reserved_gdt_blocks 32'' -w test.img" >> $OUT.new
89 $DEBUGFS -R "set_super_value reserved_gdt_blocks 32" -w $TMPFILE >> $OUT.new 2>&1
90 status=$?
91 echo Exit status is $status >> $OUT.new
92
93 $FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT.new 2>&1
94 status=$?
95 echo Exit status is $status >> $OUT.new
96
97 $FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT.new 2>&1
98 status=$?
99 echo Exit status is $status >> $OUT.new
100 sed -f $cmd_dir/filter.sed $OUT.new > $OUT
101 rm -f $OUT.new
102
103 cmp -s $OUT $EXP
104 status=$?
105
106 if [ "$status" = 0 ] ; then
107         echo "$test_name: $test_description: ok"
108         touch $test_name.ok
109 else
110         echo "$test_name: $test_description: failed"
111         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
112         rm -f tmp_expect
113 fi
114
115 unset IMAGE FSCK_OPT OUT EXP