diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 09:25:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 09:25:10 +0000 |
commit | 5dced3d1b3deca80e01415a2e35dc7972dcbfae7 (patch) | |
tree | 6a403684e0978f0287d7f0ec0e5aab1fd31a59e1 /tests/m_rootdir_acl/script | |
parent | Initial commit. (diff) | |
download | e2fsprogs-5dced3d1b3deca80e01415a2e35dc7972dcbfae7.tar.xz e2fsprogs-5dced3d1b3deca80e01415a2e35dc7972dcbfae7.zip |
Adding upstream version 1.47.0.upstream/1.47.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/m_rootdir_acl/script')
-rw-r--r-- | tests/m_rootdir_acl/script | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/tests/m_rootdir_acl/script b/tests/m_rootdir_acl/script new file mode 100644 index 0000000..a00e4c4 --- /dev/null +++ b/tests/m_rootdir_acl/script @@ -0,0 +1,110 @@ +test_description="create fs image from dir using inline_data and acls" +if ! test -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs)" + return 0 +fi + +if ! setfacl --help > /dev/null 2>&1 ; then + echo "$test_name: $test_description: skipped (no setfacl)" + return 0 +fi + +os=$(uname -s) +if [ "$os" = "GNU" ]; then + # requires Posix ACL support + echo "$test_name: $test_description: skipped for $os" + return 0 +fi + +MKFS_DIR=$(mktemp -d ./$test_name-XXXXXX.tmp) +OUT=$test_name.log +EXP=$test_dir/expect + +touch $MKFS_DIR/emptyfile +dd if=/dev/zero bs=1024 count=32 2> /dev/null | tr '\0' 'a' > $MKFS_DIR/bigfile +echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1024 2> /dev/null +echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=524288 conv=notrunc 2> /dev/null +echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1048576 conv=notrunc 2> /dev/null +echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=536870912 conv=notrunc 2> /dev/null +echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1073741824 conv=notrunc 2> /dev/null +dd if=/dev/zero of=$MKFS_DIR/bigzerofile bs=1 count=1 seek=1073741824 2> /dev/null +ln $MKFS_DIR/bigzerofile $MKFS_DIR/bigzerofile_hardlink +ln -s /silly_bs_link $MKFS_DIR/silly_bs_link +mkdir $MKFS_DIR/emptydir +mkdir $MKFS_DIR/dir +echo "Test me" > $MKFS_DIR/dir/file +mkdir $MKFS_DIR/acl_dir +echo "Test me 2" > $MKFS_DIR/acl_dir/file + +setfacl --restore=- <<EOF +# file: $MKFS_DIR/acl_dir +user::rwx +group::r-x +group:42:r-x +mask::r-x +other::r-x +default:user::rwx +default:group::r-x +default:group:4:r-x +default:mask::r-x +default:other::r-x +EOF +setfacl --restore=- <<EOF +# file: $MKFS_DIR/acl_dir/file +user::rwx +group::r-x +group:42:r-x +mask::r-x +other::r-x +EOF + +if ! getfattr -d -m - $MKFS_DIR/acl_dir | grep -q posix_acl; then + echo "$test_name: $test_description: skipped (no posix_acl xattrs)" + rm -rf $MKFS_DIR + return 0 +fi + +# use 512-byte inodes so with/out security.selinux xattr doesn't fail +$MKE2FS -q -F -o Linux -T ext4 -I 512 -O metadata_csum,inline_data,64bit -E lazy_itable_init=1 -b 1024 -d $MKFS_DIR $TMPFILE 16384 > $OUT 2>&1 + +$DUMPE2FS $TMPFILE >> $OUT 2>&1 +cat > $TMPFILE.cmd << ENDL +stat /emptyfile +stat /bigfile +stat /sparsefile +stat /bigzerofile +stat /fifo +stat /emptydir +stat /dir +stat /dir/file +stat /acl_dir +stat /acl_dir/file +ENDL +$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | egrep "(stat|Size:|Type:)" >> $OUT + +cat > $TMPFILE.cmd << ENDL +ea_list dir/file +ea_list acl_dir +ea_list acl_dir/file +ENDL +$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT 2>&1 + +$FSCK -f -n $TMPFILE >> $OUT 2>&1 + +sed -f $cmd_dir/filter.sed -f $test_dir/output.sed -e "s;$TMPFILE;test.img;" < $OUT > $OUT.tmp +mv $OUT.tmp $OUT + +# Do the verification +cmp -s $OUT $EXP +status=$? + +if [ "$status" = 0 ] ; then + echo "$test_name: $test_description: ok" + touch $test_name.ok +else + echo "$test_name: $test_description: failed" + diff $DIFF_OPTS $EXP $OUT > $test_name.failed +fi + +rm -rf $TMPFILE.cmd $MKFS_DIR +unset MKFS_DIR OUT EXP |