• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1FSCK_OPT=-fn
2OUT=$test_name.log
3EXP=$test_dir/expect
4CONF=$TMPFILE.conf
5
6cat > $CONF << ENDL
7[fs_types]
8	ext4h = {
9		features = has_journal,^extent,huge_file,^flex_bg,^uninit_bg,dir_nlink,^extra_isize,sparse_super,filetype,dir_index,ext_attr,resize_inode,^64bit,^metadata_csum
10		blocksize = 1024
11		inode_size = 256
12		make_hugefiles = true
13		hugefiles_dir = /
14		num_hugefiles = 100
15		hugefiles_slack = 0
16		hugefiles_name = aaaaa
17		hugefiles_digits = 4
18		hugefiles_size = 1M
19		zero_hugefiles = false
20	}
21ENDL
22
23echo "rebuild extent metadata_csum test" > $OUT
24
25MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h -o Linux $TMPFILE 524288 >> $OUT 2>&1
26rm -f $CONF
27
28# dump and check
29$DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.before
30$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
31status=$?
32echo Exit status is $status >> $OUT
33
34# check
35$FSCK -fyD -N test_filesys -E bmap2extent $TMPFILE >> $OUT 2>&1
36
37# dump and check
38$DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.after
39echo "Change in FS metadata:" >> $OUT
40diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT
41$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
42status=$?
43echo Exit status is $status >> $OUT
44
45rm $TMPFILE $OUT.before $OUT.after
46
47#
48# Do the verification
49#
50
51sed -f $cmd_dir/filter.sed -e 's/test_filesys:.*//g' < $OUT > $OUT.new
52mv $OUT.new $OUT
53
54cmp -s $OUT $EXP
55status=$?
56
57if [ "$status" = 0 ] ; then
58	echo "$test_name: $test_description: ok"
59	touch $test_name.ok
60else
61	echo "$test_name: $test_description: failed"
62	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
63fi
64
65unset IMAGE FSCK_OPT OUT EXP CONF
66