Whamcloud - gitweb
tests: clean up $DEBUGFS_EXE usage in scripts
[tools/e2fsprogs.git] / tests / r_move_itable_realloc / script
1 if [ $(uname -s) = "FreeBSD" ]; then
2        # creates a 96GB filesystem
3        echo "$test_name: $DESCRIPTION: skipped for FreeBSD (no sparse files)"
4        return 0
5 fi
6
7 if [ $(uname -s) = "Darwin" ]; then
8         # creates a 96GB filesystem
9         echo "$test_name: $DESCRIPTION: skipped for HFS+ (no sparse files)"
10         return 0
11 fi
12
13 if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then
14         echo "$test_name: $test_description: skipped (no debugfs/resize2fs)"
15         return 0
16 fi
17
18 FSCK_OPT=-yf
19 OUT=$test_name.log
20 if [ -f $test_dir/expect.gz ]; then
21         EXP=$test_name.tmp
22         gunzip < $test_dir/expect.gz > $EXP1
23 else
24         EXP=$test_dir/expect
25 fi
26
27 cp /dev/null $OUT
28
29 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
30
31 echo mke2fs -q -F -o Linux -b 1024 -i 1024 -O ^resize_inode -t ext4 test.img 1024000 > $OUT
32 $MKE2FS -q -F -o Linux -b 1024 -i 1024 -O ^resize_inode -t ext4 \
33         $TMPFILE 1024000 2>&1 |
34         sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT
35
36 echo resize2fs -p test.img 10240000 >> $OUT
37 $RESIZE2FS -p $TMPFILE 100000000 2>&1 |
38         sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" >> $OUT
39
40 $FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT.new 2>&1
41 status=$?
42 echo Exit status is $status >> $OUT.new
43 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
44 rm -f $OUT.new
45
46 $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1
47 $DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1
48 $DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1
49 $TUNE2FS -c 20 -U clear $TMPFILE  >/dev/null 2>&1
50
51 echo dumpe2fs -h test.img >> $OUT
52 $DUMPE2FS -h $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed -e '/Block bitmap.*$/N;s/\n  Inode bitmap/, Inode bitmap/g' >> $OUT
53
54 rm -f $TMPFILE
55
56 cmp -s $OUT $EXP
57 status=$?
58
59 if [ "$status" = 0 ] ; then
60         echo "$test_name: $test_description: ok"
61         touch $test_name.ok
62 else
63         echo "$test_name: $test_description: failed"
64         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
65         rm -f $test_name.tmp
66 fi
67
68 unset IMAGE FSCK_OPT OUT EXP