• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1test_description="create fs image from dir using inline_data and acls"
2if ! test -x $DEBUGFS_EXE; then
3	echo "$test_name: $test_description: skipped (no debugfs)"
4	return 0
5fi
6
7if ! setfacl --help > /dev/null 2>&1 ; then
8	echo "$test_name: $test_description: skipped (no setfacl)"
9	return 0
10fi
11
12MKFS_DIR=$TMPFILE.dir
13OUT=$test_name.log
14EXP=$test_dir/expect
15
16rm -rf $MKFS_DIR
17mkdir -p $MKFS_DIR
18touch $MKFS_DIR/emptyfile
19dd if=/dev/zero bs=1024 count=32 2> /dev/null | tr '\0' 'a' > $MKFS_DIR/bigfile
20echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1024 2> /dev/null
21echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=524288 conv=notrunc 2> /dev/null
22echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1048576 conv=notrunc 2> /dev/null
23echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=536870912 conv=notrunc 2> /dev/null
24echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1073741824 conv=notrunc 2> /dev/null
25dd if=/dev/zero of=$MKFS_DIR/bigzerofile bs=1 count=1 seek=1073741824 2> /dev/null
26ln $MKFS_DIR/bigzerofile $MKFS_DIR/bigzerofile_hardlink
27ln -s /silly_bs_link $MKFS_DIR/silly_bs_link
28mkdir $MKFS_DIR/emptydir
29mkdir $MKFS_DIR/dir
30echo "Test me" > $MKFS_DIR/dir/file
31mkdir $MKFS_DIR/acl_dir
32echo "Test me 2" > $MKFS_DIR/acl_dir/file
33
34setfacl --restore=- <<EOF
35# file: $MKFS_DIR/acl_dir
36user::rwx
37group::r-x
38group:42:r-x
39mask::r-x
40other::r-x
41default:user::rwx
42default:group::r-x
43default:group:4:r-x
44default:mask::r-x
45default:other::r-x
46EOF
47setfacl --restore=- <<EOF
48# file: $MKFS_DIR/acl_dir/file
49user::rwx
50group::r-x
51group:42:r-x
52mask::r-x
53other::r-x
54EOF
55
56$MKE2FS -q -F -o Linux -T ext4 -O metadata_csum,inline_data,64bit -E lazy_itable_init=1 -b 1024 -d $MKFS_DIR $TMPFILE 16384 > $OUT 2>&1
57
58$DUMPE2FS $TMPFILE >> $OUT 2>&1
59cat > $TMPFILE.cmd << ENDL
60stat /emptyfile
61stat /bigfile
62stat /sparsefile
63stat /bigzerofile
64stat /fifo
65stat /emptydir
66stat /dir
67stat /dir/file
68stat /acl_dir
69stat /acl_dir/file
70ENDL
71$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | egrep "(stat|Size:|Type:)" >> $OUT
72
73cat > $TMPFILE.cmd << ENDL
74ea_list dir/file
75ea_list acl_dir
76ea_list acl_dir/file
77ENDL
78$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT 2>&1
79
80$FSCK -f -n $TMPFILE >> $OUT 2>&1
81
82sed -f $cmd_dir/filter.sed -f $test_dir/output.sed -e "s;$TMPFILE;test.img;" < $OUT > $OUT.tmp
83mv $OUT.tmp $OUT
84
85# Do the verification
86cmp -s $OUT $EXP
87status=$?
88
89if [ "$status" = 0 ] ; then
90	echo "$test_name: $test_description: ok"
91	touch $test_name.ok
92else
93        echo "$test_name: $test_description: failed"
94        diff $DIFF_OPTS $EXP $OUT > $test_name.failed
95fi
96
97rm -rf $TMPFILE.cmd $MKFS_DIR
98unset MKFS_DIR OUT EXP
99