1FSCK_OPT=-fn
2OUT=$test_name.log
3EXP=$test_dir/expect
4CONF=$TMPFILE.conf
5
6if [ $(uname -s) = "Darwin" ]; then
7	# creates a 4TB filesystem
8	echo "$test_name: $DESCRIPTION: skipped for HFS+ (no sparse files)"
9	return 0
10fi
11
12if [ $(uname -s) = "FreeBSD" ]; then
13	# creates a 4TB filesystem
14	echo "$test_name: $DESCRIPTION: skipped for FreeBSD (no sparse files)"
15	return 0
16fi
17
18cat > $CONF << ENDL
19[fs_types]
20	hugefile = {
21		features = extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^resize_inode,sparse_super2
22		hash_alg = half_md4
23		num_backup_sb = 0
24		packed_meta_blocks = 1
25		make_hugefiles = 1
26		inode_ratio = 4194304
27		hugefiles_dir = /store
28		hugefiles_name = big-data
29		hugefiles_digits = 0
30		hugefiles_size = 0
31		hugefiles_align = 256M
32		num_hugefiles = 1
33		zero_hugefiles = false
34		flex_bg_size = 262144
35	}
36ENDL
37
38echo "mke2fs -F -T hugefile test.img 4T" > $OUT
39MKE2FS_CONFIG=$CONF $MKE2FS -F -T hugefile $TMPFILE 4T >> $OUT 2>&1
40rm -rf $CONF
41
42# check the file system if we get this far, we succeeded...
43$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
44status=$?
45echo Exit status is $status >> $OUT
46
47echo 'debugfs -R "extents /store/big-data" test.img | head' >> $OUT
48
49$DEBUGFS -R "extents /store/big-data" $TMPFILE 2>&1 | head -n 20 >> $OUT 2>&1
50
51rm $TMPFILE
52
53#
54# Do the verification
55#
56
57sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new
58mv $OUT.new $OUT
59
60cmp -s $OUT $EXP
61status=$?
62
63if [ "$status" = 0 ] ; then
64	echo "$test_name: $test_description: ok"
65	touch $test_name.ok
66else
67	echo "$test_name: $test_description: failed"
68	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
69fi
70
71unset IMAGE FSCK_OPT OUT EXP CONF
72