Whamcloud - gitweb
tests: don't run sed multiple times on test output
[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 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
28
29 echo mke2fs -q -F -o Linux -b 1024 -i 1024 -O ^resize_inode -t ext4 test.img 1024000 > $OUT
30 $MKE2FS -q -F -o Linux -b 1024 -i 1024 -O ^resize_inode -t ext4 \
31         $TMPFILE 1024000 >> $OUT 2>&1
32
33 echo resize2fs -p test.img 10240000 >> $OUT
34 $RESIZE2FS -p $TMPFILE 100000000 >> $OUT 2>&1
35
36 $FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT 2>&1
37 status=$?
38 echo Exit status is $status >> $OUT
39
40 $DEBUGFS -R "set_super_value lastcheck 0" -w $TMPFILE >/dev/null 2>&1
41 $DEBUGFS -R "set_super_value hash_seed null" -w $TMPFILE >/dev/null 2>&1
42 $DEBUGFS -R "set_super_value mkfs_time 0" -w $TMPFILE >/dev/null 2>&1
43 $TUNE2FS -c 20 -U clear $TMPFILE  >/dev/null 2>&1
44
45 echo dumpe2fs -h test.img >> $OUT
46 $DUMPE2FS -h $TMPFILE >> $OUT 2>&1
47 sed -f $cmd_dir/filter.sed -e '/Block bitmap.*$/N;s/\n  Inode bitmap/, Inode bitmap/g' < $OUT > $OUT.new
48 mv $OUT.new $OUT
49 rm -f $TMPFILE
50
51 cmp -s $OUT $EXP
52 status=$?
53
54 if [ "$status" = 0 ] ; then
55         echo "$test_name: $test_description: ok"
56         touch $test_name.ok
57 else
58         echo "$test_name: $test_description: failed"
59         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
60         rm -f $test_name.tmp
61 fi
62
63 unset IMAGE FSCK_OPT OUT EXP