• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then
2	echo "$test_name: $test_description: skipped (no debugfs/resize2fs)"
3	return 0
4fi
5
6FSCK_OPT=-fn
7OUT=$test_name.log
8EXP=$test_dir/expect
9CONF=$TMPFILE.conf
10
11cat > $CONF << ENDL
12[fs_types]
13	ext4h = {
14		features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,resize_inode
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	}
25ENDL
26
27echo "resize2fs test" > $OUT
28
29MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1
30rm -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
35status=$?
36echo Exit status is $status >> $OUT
37
38# resize it
39echo "resize2fs test.img -b" >> $OUT
40$RESIZE2FS -b -f $TMPFILE >> $OUT 2>&1
41status=$?
42echo 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
46echo "Change in FS metadata:" >> $OUT
47diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT
48$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
49status=$?
50echo Exit status is $status >> $OUT
51
52rm $TMPFILE $OUT.before $OUT.after
53
54#
55# Do the verification
56#
57
58sed -f $cmd_dir/filter.sed -e 's/test_filesys:.*//g' < $OUT > $OUT.new
59mv $OUT.new $OUT
60
61cmp -s $OUT $EXP
62status=$?
63
64if [ "$status" = 0 ] ; then
65	echo "$test_name: $test_description: ok"
66	touch $test_name.ok
67else
68	echo "$test_name: $test_description: failed"
69	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
70fi
71
72unset IMAGE FSCK_OPT OUT EXP CONF
73