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