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 12os=$(uname -s) 13if [ "$os" = "GNU" ]; then 14 # requires Posix ACL support 15 echo "$test_name: $test_description: skipped for $os" 16 return 0 17fi 18 19MKFS_DIR=$TMPFILE.dir 20OUT=$test_name.log 21EXP=$test_dir/expect 22 23rm -rf $MKFS_DIR 24mkdir -p $MKFS_DIR 25touch $MKFS_DIR/emptyfile 26dd if=/dev/zero bs=1024 count=32 2> /dev/null | tr '\0' 'a' > $MKFS_DIR/bigfile 27echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1024 2> /dev/null 28echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=524288 conv=notrunc 2> /dev/null 29echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1048576 conv=notrunc 2> /dev/null 30echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=536870912 conv=notrunc 2> /dev/null 31echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1073741824 conv=notrunc 2> /dev/null 32dd if=/dev/zero of=$MKFS_DIR/bigzerofile bs=1 count=1 seek=1073741824 2> /dev/null 33ln $MKFS_DIR/bigzerofile $MKFS_DIR/bigzerofile_hardlink 34ln -s /silly_bs_link $MKFS_DIR/silly_bs_link 35mkdir $MKFS_DIR/emptydir 36mkdir $MKFS_DIR/dir 37echo "Test me" > $MKFS_DIR/dir/file 38mkdir $MKFS_DIR/acl_dir 39echo "Test me 2" > $MKFS_DIR/acl_dir/file 40 41setfacl --restore=- <<EOF 42# file: $MKFS_DIR/acl_dir 43user::rwx 44group::r-x 45group:42:r-x 46mask::r-x 47other::r-x 48default:user::rwx 49default:group::r-x 50default:group:4:r-x 51default:mask::r-x 52default:other::r-x 53EOF 54setfacl --restore=- <<EOF 55# file: $MKFS_DIR/acl_dir/file 56user::rwx 57group::r-x 58group:42:r-x 59mask::r-x 60other::r-x 61EOF 62 63$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 64 65$DUMPE2FS $TMPFILE >> $OUT 2>&1 66cat > $TMPFILE.cmd << ENDL 67stat /emptyfile 68stat /bigfile 69stat /sparsefile 70stat /bigzerofile 71stat /fifo 72stat /emptydir 73stat /dir 74stat /dir/file 75stat /acl_dir 76stat /acl_dir/file 77ENDL 78$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | egrep "(stat|Size:|Type:)" >> $OUT 79 80cat > $TMPFILE.cmd << ENDL 81ea_list dir/file 82ea_list acl_dir 83ea_list acl_dir/file 84ENDL 85$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT 2>&1 86 87$FSCK -f -n $TMPFILE >> $OUT 2>&1 88 89sed -f $cmd_dir/filter.sed -f $test_dir/output.sed -e "s;$TMPFILE;test.img;" < $OUT > $OUT.tmp 90mv $OUT.tmp $OUT 91 92# Do the verification 93cmp -s $OUT $EXP 94status=$? 95 96if [ "$status" = 0 ] ; then 97 echo "$test_name: $test_description: ok" 98 touch $test_name.ok 99else 100 echo "$test_name: $test_description: failed" 101 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 102fi 103 104rm -rf $TMPFILE.cmd $MKFS_DIR 105unset MKFS_DIR OUT EXP 106