Whamcloud - gitweb
tests: don't run sed multiple times on test output
[tools/e2fsprogs.git] / tests / r_32to64bit_move_itable / script
1 if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then
2         echo "$test_name: $test_description: skipped (no debugfs/resize2fs)"
3         return 0
4 fi
5
6 FSCK_OPT=-fn
7 OUT=$test_name.log
8 EXP=$test_dir/expect
9 CONF=$TMPFILE.conf
10
11 cat > $CONF << ENDL
12 [fs_types]
13         ext4h = {
14                 features = has_journal,extent,huge_file,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,^resize_inode,^meta_bg,^flex_bg
15                 blocksize = 1024
16                 inode_size = 256
17                 make_hugefiles = true
18                 hugefiles_dir = /
19                 hugefiles_slack = 0
20                 hugefiles_name = aaaaa
21                 hugefiles_digits = 4
22                 hugefiles_size = 1M
23                 zero_hugefiles = false
24         }
25 ENDL
26
27 echo "resize2fs test" > $OUT
28
29 MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 786432 >> $OUT 2>&1
30 rm -f $CONF
31
32 # dump and check
33 ($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | sed -f $cmd_dir/filter.sed > $OUT.before
34 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
35 status=$?
36 echo Exit status is $status >> $OUT
37
38 # convert it
39 echo "resize2fs test.img -b" >> $OUT
40 $RESIZE2FS -b -f $TMPFILE >> $OUT 2>&1
41 status=$?
42 echo Exit status is $status >> $OUT
43
44 # dump and check
45 ($DUMPE2FS -h $TMPFILE; $DUMPE2FS -g $TMPFILE) 2> /dev/null | sed -f $cmd_dir/filter.sed > $OUT.after
46 echo "Change in FS metadata:" >> $OUT
47 diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT
48 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
49 status=$?
50 echo Exit status is $status >> $OUT
51
52 rm $TMPFILE $OUT.before $OUT.after
53
54 #
55 # Do the verification
56 #
57
58 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new
59 mv $OUT.new $OUT
60
61 cmp -s $OUT $EXP
62 status=$?
63
64 if [ "$status" = 0 ] ; then
65         echo "$test_name: $test_description: ok"
66         touch $test_name.ok
67 else
68         echo "$test_name: $test_description: failed"
69         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
70 fi
71
72 unset IMAGE FSCK_OPT OUT EXP CONF