Richacl tests
v4 cover Richacl tests
Hello,
here is a new version of the richacl tests. According to feedback from the previous posting (http://oss.sgi.com/archives/xfs/2015-12/msg00316.html), each of the richacl tests is not run separately, on a new scratch filesystem.
Thanks,
Andreas
Andreas Gruenbacher (4):
Rename output file templates to match TEST.out*
check: Add support for tests without *.out files xfs/191: Remove obsolete nfs4acl tests Add richacl tests
.gitignore | 19 +++ Makefile | 2 +- check | 77 ++++++--- common/rc | 36 ++++ nfs4acl/Makefile | 29 ---- nfs4acl/apply-mask.test | 143 ---------------- nfs4acl/basic.test | 70 -------- nfs4acl/chmod.test | 31 ---- nfs4acl/chown.test | 63 ------- nfs4acl/computed-mode.test | 62 ------- nfs4acl/create.test | 35 ---- nfs4acl/ctime.test | 36 ---- nfs4acl/delete.test | 77 --------- nfs4acl/run | 298 --------------------------------- nfs4acl/unrepresentable.test | 20 --- nfs4acl/write-vs-append.test | 46 ----- richacl/Makefile | 23 +++ richacl/apply-masks | 163 ++++++++++++++++++ richacl/auto-inheritance | 191 +++++++++++++++++++++ richacl/basic | 97 +++++++++++ richacl/chmod | 40 +++++ richacl/chown | 42 +++++ richacl/create | 36 ++++ richacl/ctime | 35 ++++ richacl/delete | 89 ++++++++++ richacl/setrichacl-modify | 57 +++++++ richacl/test-lib.sh | 154 +++++++++++++++++ richacl/write-vs-append | 54 ++++++ tests/generic/338 | 67 ++++++++ tests/generic/339-apply-masks | 1 + tests/generic/340-auto-inheritance | 1 + tests/generic/341-basic | 1 + tests/generic/342-chmod | 1 + tests/generic/343-chown | 1 + tests/generic/344-create | 1 + tests/generic/345-ctime | 1 + tests/generic/346-delete | 1 + tests/generic/347-setrichacl-modify | 1 + tests/generic/348-write-vs-append | 1 + tests/generic/group | 10 ++ tests/xfs/096 | 4 +- tests/xfs/096.external | 50 ------ tests/xfs/096.internal | 51 ------ tests/xfs/096.out.external | 50 ++++++ tests/xfs/096.out.internal | 51 ++++++ tests/xfs/191 | 75 --------- tests/xfs/191.out | 324 ------------------------------------ tests/xfs/group | 1 - 48 files changed, 1277 insertions(+), 1441 deletions(-) delete mode 100644 nfs4acl/Makefile delete mode 100644 nfs4acl/apply-mask.test delete mode 100644 nfs4acl/basic.test delete mode 100644 nfs4acl/chmod.test delete mode 100644 nfs4acl/chown.test delete mode 100644 nfs4acl/computed-mode.test delete mode 100644 nfs4acl/create.test delete mode 100644 nfs4acl/ctime.test delete mode 100644 nfs4acl/delete.test delete mode 100755 nfs4acl/run delete mode 100644 nfs4acl/unrepresentable.test delete mode 100644 nfs4acl/write-vs-append.test create mode 100644 richacl/Makefile create mode 100755 richacl/apply-masks create mode 100755 richacl/auto-inheritance create mode 100755 richacl/basic create mode 100755 richacl/chmod create mode 100755 richacl/chown create mode 100755 richacl/create create mode 100755 richacl/ctime create mode 100755 richacl/delete create mode 100755 richacl/setrichacl-modify create mode 100644 richacl/test-lib.sh create mode 100755 richacl/write-vs-append create mode 100755 tests/generic/338 create mode 120000 tests/generic/339-apply-masks create mode 120000 tests/generic/340-auto-inheritance create mode 120000 tests/generic/341-basic create mode 120000 tests/generic/342-chmod create mode 120000 tests/generic/343-chown create mode 120000 tests/generic/344-create create mode 120000 tests/generic/345-ctime create mode 120000 tests/generic/346-delete create mode 120000 tests/generic/347-setrichacl-modify create mode 120000 tests/generic/348-write-vs-append delete mode 100644 tests/xfs/096.external delete mode 100644 tests/xfs/096.internal create mode 100644 tests/xfs/096.out.external create mode 100644 tests/xfs/096.out.internal delete mode 100755 tests/xfs/191 delete mode 100644 tests/xfs/191.out
Signature · 6 lines
2.5.0 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 1/4 Rename output file templates to match TEST.out*
Rename the expected output files so that they all match "$TEST_NAME.out*". That way, we can statically check if a test has any .out* files.
Add $TEST_NAME.out and similar symlinks to .gitignore.
--- .gitignore | 19 +++++++++++++++++ tests/xfs/096 | 4 ++-- tests/xfs/096.external | 50 --------------------------------------------- tests/xfs/096.internal | 51 ---------------------------------------------- tests/xfs/096.out.external | 50 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/096.out.internal | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 122 insertions(+), 103 deletions(-) delete mode 100644 tests/xfs/096.external delete mode 100644 tests/xfs/096.internal create mode 100644 tests/xfs/096.out.external create mode 100644 tests/xfs/096.out.internal
.gitignore +19 -0
@@ -199,3 +199,22 @@ /dmapi/src/suite2/src/test_invis /dmapi/src/suite2/src/test_region /dmapi/src/suite2/src/test_rights + +# Symlinked files +/tests/generic/088.out +/tests/generic/097.out +/tests/xfs/018.op +/tests/xfs/022.out +/tests/xfs/023.out +/tests/xfs/030.out +/tests/xfs/031.out +/tests/xfs/033.out +/tests/xfs/035.out +/tests/xfs/036.out +/tests/xfs/039.out +/tests/xfs/043.out +/tests/xfs/055.out +/tests/xfs/071.out +/tests/xfs/082.op +/tests/xfs/096.out +/tests/xfs/146.out
tests/xfs/096 +2 -2
@@ -109,9 +109,9 @@ _require_v2log # choose .out file based on internal/external log rm -f $seqfull.out if [ "$USE_EXTERNAL" = yes ]; then - ln -s $seq.external $seqfull.out + ln -s $seq.out.external $seqfull.out else - ln -s $seq.internal $seqfull.out + ln -s $seq.out.internal $seqfull.out fi # maximum log record size
tests/xfs/096.external deleted +0 -50
50 lines not on this page · raw message
tests/xfs/096.internal deleted +0 -51
51 lines not on this page · raw message
tests/xfs/096.out.external new file +50 -0
50 lines not on this page · raw message
tests/xfs/096.out.internal new file +51 -0
51 lines not on this page · raw message
Signature · 6 lines
2.5.0 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 2/4 check: Add support for tests without *.out files
In reply to Andreas GruenbacherAdd support for tests which report their status through their exit code instead of producing output that is compared with the expected output.
When such a test returns with exit code 77, it is assumed to have been skipped; all other non-zero exit codes are treated as test failures.
--- check | 77 +++++++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 27 deletions(-)
check +50 -27
@@ -203,6 +203,13 @@ _prepare_test_list() fi } +# Check if a test has any .out* files +has_out_files() +{ + set -- "$1".out* + [ $# -gt 0 -a -e "$1" ] +} + # Process command arguments first. while [ $# -gt 0 ]; do case "$1" in
@@ -635,6 +642,13 @@ for section in $HOST_OPTIONS_SECTIONS; do err=true fi + if ! has_out_files $seq; then + if [ $sts -eq 77 ]; then + cat $tmp.out > $seqres.notrun + sts=0 + fi + fi + if [ -f $seqres.notrun ] then $timestamp || echo -n " [not run] "
@@ -647,41 +661,50 @@ for section in $HOST_OPTIONS_SECTIONS; do echo -n " [failed, exit status $sts]" err=true fi - if [ ! -f $seq.out ] - then - echo " - no qualified output" - err=true - else - # coreutils 8.16+ changed quote formats in error messages from - # `foo' to 'foo'. Filter old versions to match the new version. - sed -i "s/\`/\'/g" $tmp.out - if diff $seq.out $tmp.out >/dev/null 2>&1 + if has_out_files $seq; then + if [ ! -f $seq.out ] then - if $err + echo " - no qualified output" + err=true + else + # coreutils 8.16+ changed quote formats in error messages from + # `foo' to 'foo'. Filter old versions to match the new version. + sed -i "s/\`/\'/g" $tmp.out + + if ! diff $seq.out $tmp.out >/dev/null 2>&1 then - : - else - echo "$seqnum `expr $stop - $start`" >>$tmp.time - echo -n " `expr $stop - $start`s" + echo " - output mismatch (see $seqres.out.bad)" + mv $tmp.out $seqres.out.bad + $diff $seq.out $seqres.out.bad | { + if test "$DIFF_LENGTH" -le 0; then + cat + else + head -n "$DIFF_LENGTH" + echo "..." + echo "(Run '$diff $seq.out $seqres.out.bad'" \ + " to see the entire diff)" + fi; } | \ + sed -e 's/^\(.\)/ \1/' + err=true fi - echo "" + fi + else + if ! $err; then + mv $tmp.out $seqres.out.good else - echo " - output mismatch (see $seqres.out.bad)" mv $tmp.out $seqres.out.bad - $diff $seq.out $seqres.out.bad | { - if test "$DIFF_LENGTH" -le 0; then - cat - else - head -n "$DIFF_LENGTH" - echo "..." - echo "(Run '$diff $seq.out $seqres.out.bad'" \ - " to see the entire diff)" - fi; } | \ - sed -e 's/^\(.\)/ \1/' - err=true + echo " - output (see $seqres.out.bad)" + cat $seqres.out.bad fi fi + + if ! $err; then + echo "$seqnum `expr $stop - $start`" >>$tmp.time + echo -n " `expr $stop - $start`s" + echo "" + fi + try="$try $seqnum" n_try=`expr $n_try + 1` _check_filesystems
Signature · 6 lines
2.5.0 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 3/4 xfs/191: Remove obsolete nfs4acl tests
In reply to Andreas GruenbacherThe nfs4acl tests don't make sense anymore as they have been obsoleted by richacls.
--- nfs4acl/Makefile | 29 ---- nfs4acl/apply-mask.test | 143 ------------------- nfs4acl/basic.test | 70 ---------- nfs4acl/chmod.test | 31 ----- nfs4acl/chown.test | 63 --------- nfs4acl/computed-mode.test | 62 --------- nfs4acl/create.test | 35 ----- nfs4acl/ctime.test | 36 ----- nfs4acl/delete.test | 77 ---------- nfs4acl/run | 298 --------------------------------------- nfs4acl/unrepresentable.test | 20 --- nfs4acl/write-vs-append.test | 46 ------ tests/xfs/191 | 75 ---------- tests/xfs/191.out | 324 ------------------------------------------- tests/xfs/group | 1 - 15 files changed, 1310 deletions(-) delete mode 100644 nfs4acl/Makefile delete mode 100644 nfs4acl/apply-mask.test delete mode 100644 nfs4acl/basic.test delete mode 100644 nfs4acl/chmod.test delete mode 100644 nfs4acl/chown.test delete mode 100644 nfs4acl/computed-mode.test delete mode 100644 nfs4acl/create.test delete mode 100644 nfs4acl/ctime.test delete mode 100644 nfs4acl/delete.test delete mode 100755 nfs4acl/run delete mode 100644 nfs4acl/unrepresentable.test delete mode 100644 nfs4acl/write-vs-append.test delete mode 100755 tests/xfs/191 delete mode 100644 tests/xfs/191.out
nfs4acl/Makefile deleted +0 -29
@@ -1,29 +0,0 @@ -#----------------------------------------------------------------------- -# Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it would be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -#----------------------------------------------------------------------- - -TOPDIR = .. -include $(TOPDIR)/include/builddefs - -LSRCFILES = run \ - apply-mask.test chmod.test computed-mode.test ctime.test \ - unrepresentable.test basic.test chown.test create.test \ - delete.test write-vs-append.test - -include $(BUILDRULES) - -default install install-dev install-lib:
nfs4acl/apply-mask.test deleted +0 -143
143 lines not on this page · raw message
nfs4acl/basic.test deleted +0 -70
70 lines not on this page · raw message
nfs4acl/chmod.test deleted +0 -31
@@ -1,31 +0,0 @@ -$ mkdir d -$ cd d - -$ whoami -> root - -$ touch a - -Neet to have write_acl permission to chmod or set the acl: - $ su bin - $ chmod 666 a - > chmod: changing permissions of `a': Operation not permitted - $ nfs4acl --set 'bin:rwM::allow' a - > a: Operation not permitted - -$ su -$ nfs4acl --set 'bin:rwm::allow' a - -Can set the acl now: - $ su bin - $ nfs4acl --set 'bin:rwm::allow' a - -A chmod limits the permissions to the specified mode, which always disables -write_acl: - $ chmod 666 a - $ nfs4acl --set 'bin:rwm::allow' a - > a: Operation not permitted - -$ su -$ cd .. -$ rm -rf d
nfs4acl/chown.test deleted +0 -63
63 lines not on this page · raw message
nfs4acl/computed-mode.test deleted +0 -62
62 lines not on this page · raw message
nfs4acl/create.test deleted +0 -35
@@ -1,35 +0,0 @@ -$ mkdir d -$ cd d - -$ whoami -> root - -$ mkdir d1 d2 d3 d4 -$ nfs4acl --set 'daemon:wx::allow' d2 -$ nfs4acl --set 'daemon:ax::allow' d3 -$ nfs4acl --set 'daemon:wax::allow' d4 - -$ su daemon - -Cannot create files or directories without permissions: - $ touch d1/f - > touch: cannot touch `d1/f': Permission denied - $ mkdir d1/d - > mkdir: cannot create directory `d1/d': Permission denied - -Can create files with add_file (w) permission: - $ touch d2/f - $ mkdir d2/d - > mkdir: cannot create directory `d2/d': Permission denied - -Can create directories with add_subdirectory (p) permission: - $ touch d3/f - > touch: cannot touch `d3/f': Permission denied - $ mkdir d3/d - -Both permissions at the same time: - $ touch d4/f - $ mkdir d4/d -$ su -$ cd .. -$ rm -rf d
nfs4acl/ctime.test deleted +0 -36
@@ -1,36 +0,0 @@ -$ mkdir d -$ cd d - -$ whoami -> root - -$ touch a b -$ sleep 1 - -Without write access, the ctime cannot be changed. - $ su bin - $ touch a - > touch: cannot touch `a': Permission denied - -With write access, the ctime can be set to the current time, but not to -any other time: - $ su - $ nfs4acl --set 'bin:rw::allow' a - - $ su bin - $ touch a - $ [ b -ot a ] || echo 'b should be older than a' - $ touch -r b a - > touch: setting times of `a': Operation not permitted - -With set_attributes access, the ctime can be set to an arbitrary time: - $ su - $ nfs4acl --set 'bin:rwt::allow' a - - $ su bin - $ touch -r b a - $ [ b -ot a -o a -ot b ] && echo 'a should be as old as b' - -$ su -$ cd .. -$ rm -rf d
nfs4acl/delete.test deleted +0 -77
77 lines not on this page · raw message
nfs4acl/run deleted +0 -298
298 lines not on this page · raw message
nfs4acl/unrepresentable.test deleted +0 -20
@@ -1,20 +0,0 @@ -Test cases for (acl, masks) pairs that cannot be represented as -pure ACLs - -$ rm -rf d -$ mkdir d -$ cd d - -$ touch x - -$ nfs4acl --set 'group@:rw::allow' x -$ chmod 600 x -$ ls -l x | cut -d ' ' -f 1 -> -rw------- -$ nfs4acl --get x -> x: -> -$ rm -f x - -$ cd .. -$ rm -rf d
nfs4acl/write-vs-append.test deleted +0 -46
46 lines not on this page · raw message
tests/xfs/191 deleted +0 -75
75 lines not on this page · raw message
tests/xfs/191.out deleted +0 -324
324 lines not on this page · raw message
tests/xfs/group +0 -1
@@ -188,7 +188,6 @@ 188 ci dir auto 189 mount auto quick 190 rw auto quick -191 nfs4acl auto 192 auto quick clone 193 auto quick clone 194 rw auto
Signature · 6 lines
2.5.0 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 4/4 Add richacl tests
In reply to Andreas GruenbacherAdd the Rich Access Control List tests from the richacl package. The tests requires SCRATCH_DEV and SCRATCH_MNT to be set. They try to create and mount a scratch filesystem with richacl support; if that fails, the tests will be skipped.
--- Makefile | 2 +- common/rc | 36 +++++++ richacl/Makefile | 23 +++++ richacl/apply-masks | 163 ++++++++++++++++++++++++++++++ richacl/auto-inheritance | 191 ++++++++++++++++++++++++++++++++++++ richacl/basic | 97 ++++++++++++++++++ richacl/chmod | 40 ++++++++ richacl/chown | 42 ++++++++ richacl/create | 36 +++++++ richacl/ctime | 35 +++++++ richacl/delete | 89 +++++++++++++++++ richacl/setrichacl-modify | 57 +++++++++++ richacl/test-lib.sh | 154 +++++++++++++++++++++++++++++ richacl/write-vs-append | 54 ++++++++++ tests/generic/338 | 67 +++++++++++++ tests/generic/339-apply-masks | 1 + tests/generic/340-auto-inheritance | 1 + tests/generic/341-basic | 1 + tests/generic/342-chmod | 1 + tests/generic/343-chown | 1 + tests/generic/344-create | 1 + tests/generic/345-ctime | 1 + tests/generic/346-delete | 1 + tests/generic/347-setrichacl-modify | 1 + tests/generic/348-write-vs-append | 1 + tests/generic/group | 10 ++ 26 files changed, 1105 insertions(+), 1 deletion(-) create mode 100644 richacl/Makefile create mode 100755 richacl/apply-masks create mode 100755 richacl/auto-inheritance create mode 100755 richacl/basic create mode 100755 richacl/chmod create mode 100755 richacl/chown create mode 100755 richacl/create create mode 100755 richacl/ctime create mode 100755 richacl/delete create mode 100755 richacl/setrichacl-modify create mode 100644 richacl/test-lib.sh create mode 100755 richacl/write-vs-append create mode 100755 tests/generic/338 create mode 120000 tests/generic/339-apply-masks create mode 120000 tests/generic/340-auto-inheritance create mode 120000 tests/generic/341-basic create mode 120000 tests/generic/342-chmod create mode 120000 tests/generic/343-chown create mode 120000 tests/generic/344-create create mode 120000 tests/generic/345-ctime create mode 120000 tests/generic/346-delete create mode 120000 tests/generic/347-setrichacl-modify create mode 120000 tests/generic/348-write-vs-append
Makefile +1 -1
@@ -57,7 +57,7 @@ TOOL_SUBDIRS += dmapi endif export TESTS_DIR = tests -SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR) +SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR) richacl default: include/builddefs $(DMAPI_MAKEFILE) ifeq ($(HAVE_BUILDDEFS), no)
common/rc +36 -0
@@ -1908,6 +1908,42 @@ _require_xfs_db_command() _notrun "xfs_db $command support is missing" } +_setup_scratch_richacl_xfs() +{ + _scratch_mkfs_xfs_supported -m richacl=1 >/dev/null 2>&1 \ + || _notrun "mkfs.xfs doesn't have richacl feature" + + _scratch_mkfs_xfs -m richacl=1 >/dev/null 2>&1 + _scratch_mount >/dev/null 2>&1 \ + || _notrun "kernel doesn't support richacl feature" +} + +__setup_scratch_richacl() +{ + _scratch_mkfs -O richacl >/dev/null 2>&1 \ + || _notrun "can't mkfs $FSTYP with option -O richacl" + _scratch_mount >/dev/null 2>&1 \ + || _notrun "kernel doesn't support richacl feature on $FSTYP" +} + +_setup_scratch_richacl() +{ + GETRICHACL_PROG=`set_prog_path getrichacl` + _require_command "$GETRICHACL_PROG" getrichacl + SETRICHACL_PROG=`set_prog_path setrichacl` + _require_command "$SETRICHACL_PROG" setrichacl + + _require_scratch + case "$FSTYP" in + xfs) _setup_scratch_richacl_xfs + ;; + ext4) __setup_scratch_richacl + ;; + *) _notrun "this test requires richacl support on \$SCRATCH_DEV" + ;; + esac +} + # check that kernel and filesystem support direct I/O _require_odirect() {
richacl/Makefile new file +23 -0
@@ -0,0 +1,23 @@ +# +# Copyright (C) 2016 Red Hat, Inc. +# + +TESTS = apply-masks basic chmod chown create delete setrichacl-modify \ + write-vs-append ctime auto-inheritance + +LSRCFILES = test-lib.sh $(TESTS) + +TOPDIR = .. +include $(TOPDIR)/include/builddefs + +TARGET_DIR = $(PKG_LIB_DIR)/richacl + +include $(BUILDRULES) + +install: + $(INSTALL) -m 755 -d $(TARGET_DIR) + $(INSTALL) -m 755 $(TESTS) $(TARGET_DIR) + $(INSTALL) -m 644 test-lib.sh $(TARGET_DIR) + +# Nothing. +install-dev install-lib:
richacl/apply-masks new file +163 -0
163 lines not on this page · raw message
richacl/auto-inheritance new file +191 -0
191 lines not on this page · raw message
richacl/basic new file +97 -0
97 lines not on this page · raw message
richacl/chmod new file +40 -0
@@ -0,0 +1,40 @@ +#! /bin/bash + +. ${0%/*}/test-lib.sh + +require_runas +require_richacls +use_testdir + +export LC_ALL=C + +# Create file as root +ncheck "touch a" + +# We cannot set the acl as another user +runas -u 99 -g 99 +check "setrichacl --set 'u:99:rwc::allow' a || echo status: \$?" <<EOF +a: Operation not permitted +status: 1 +EOF + +# We cannot chmod as another user +check "chmod 666 a || echo status: \$?" <<EOF +chmod: changing permissions of 'a': Operation not permitted +status: 1 +EOF + +# Give user 99 the write_acl permission +runas +ncheck "setrichacl --set 'u:99:rwpC::allow' a" + +# Now user 99 can setrichacl and chmod ... +runas -u 99 -g 99 +ncheck "setrichacl --set 'u:99:rwpC::allow' a" +ncheck "chmod 666 a" + +# ... but chmod disables the write_acl permission +check "setrichacl --set 'u:99:rwpC::allow' a || echo status: \$?" <<EOF +a: Operation not permitted +status: 1 +EOF
richacl/chown new file +42 -0
42 lines not on this page · raw message
richacl/create new file +36 -0
@@ -0,0 +1,36 @@ +#! /bin/bash + +. ${0%/*}/test-lib.sh + +require_runas +require_richacls +use_testdir + +export LC_ALL=C + +# Create directories as root with different permissions +ncheck "mkdir d1 d2 d3" +ncheck "setrichacl --set 'u:99:wx::allow' d2" +ncheck "setrichacl --set 'u:99:px::allow' d3" + +runas -u 99 -g 99 + +# Cannot create files or directories without permissions +check "touch d1/f || :" <<EOF +touch: cannot touch 'd1/f': Permission denied +EOF +check "mkdir d1/d || :" <<EOF +mkdir: cannot create directory 'd1/d': Permission denied +EOF + +# Can create files with add_file (w) permission +ncheck "touch d2/f" +check "mkdir d2/d || :" <<EOF +mkdir: cannot create directory 'd2/d': Permission denied +EOF + +# Can create directories with add_subdirectory (p) permission +check "touch d3/f || :" <<EOF +touch: cannot touch 'd3/f': Permission denied +EOF +ncheck "mkdir d3/d"
richacl/ctime new file +35 -0
@@ -0,0 +1,35 @@ +#! /bin/bash + +. ${0%/*}/test-lib.sh + +require_runas +require_richacls +use_testdir + +export LC_ALL=C + +ncheck "touch a" + +# Without write access, the ctime cannot be changed +runas -u 99 -g 99 +check "touch a || :" <<EOF +touch: cannot touch 'a': Permission denied +EOF + +runas +ncheck "setrichacl --set 'u:99:rw::allow' a" + +# With write access, the ctime can be set to the current time, but not to +# any other time +runas -u 99 -g 99 +ncheck "touch a" +check "touch -d '1 hour ago' a || :" <<EOF +touch: setting times of 'a': Operation not permitted +EOF + +runas +ncheck "setrichacl --set 'u:99:rwA::allow' a" + +# With set_attributes access, the ctime can be set to an arbitrary time +runas -u 99 -g 99 +ncheck "touch -d '1 hour ago' a"
richacl/delete new file +89 -0
89 lines not on this page · raw message
richacl/setrichacl-modify new file +57 -0
57 lines not on this page · raw message
richacl/test-lib.sh new file +154 -0
154 lines not on this page · raw message
richacl/write-vs-append new file +54 -0
54 lines not on this page · raw message
tests/generic/338 new file +67 -0
67 lines not on this page · raw message
tests/generic/339-apply-masks new file +1 -0
@@ -0,0 +1 @@ +338
tests/generic/340-auto-inheritance new file +1 -0
@@ -0,0 +1 @@ +338
tests/generic/341-basic new file +1 -0
@@ -0,0 +1 @@ +338
tests/generic/342-chmod new file +1 -0
@@ -0,0 +1 @@ +338
tests/generic/343-chown new file +1 -0
@@ -0,0 +1 @@ +338
tests/generic/344-create new file +1 -0
@@ -0,0 +1 @@ +338
tests/generic/345-ctime new file +1 -0
@@ -0,0 +1 @@ +338
tests/generic/346-delete new file +1 -0
@@ -0,0 +1 @@ +338
tests/generic/347-setrichacl-modify new file +1 -0
@@ -0,0 +1 @@ +338
tests/generic/348-write-vs-append new file +1 -0
@@ -0,0 +1 @@ +338
tests/generic/group +10 -0
@@ -340,3 +340,13 @@ 335 auto quick metadata 336 auto quick metadata 337 auto quick metadata +339-apply-masks richacl auto +340-auto-inheritance richacl auto +341-basic richacl auto +342-chmod richacl auto +343-chown richacl auto +344-create richacl auto +345-ctime richacl auto +346-delete richacl auto +347-setrichacl-modify richacl auto +348-write-vs-append richacl auto
Signature · 6 lines
2.5.0 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH v4 4/4 generic/338: Add richacl tests
In reply to Andreas GruenbacherAdd the Rich Access Control List tests from the richacl package as generic/338. The new test requires SCRATCH_DEV and SCRATCH_MNT to be set. It tries to create and mount a scratch filesystem with richacl support before running the tests; if that fails, the richacl tests will be skipped.
--- Makefile | 2 +- common/rc | 32 ++++++++ richacl/Makefile | 23 ++++++ richacl/apply-masks | 163 +++++++++++++++++++++++++++++++++++++++ richacl/auto-inheritance | 191 ++++++++++++++++++++++++++++++++++++++++++++++ richacl/basic | 97 +++++++++++++++++++++++ richacl/chmod | 40 ++++++++++ richacl/chown | 42 ++++++++++ richacl/create | 36 +++++++++ richacl/ctime | 35 +++++++++ richacl/delete | 89 +++++++++++++++++++++ richacl/setrichacl-modify | 57 ++++++++++++++ richacl/test-lib.sh | 154 +++++++++++++++++++++++++++++++++++++ richacl/write-vs-append | 54 +++++++++++++ tests/generic/338 | 78 +++++++++++++++++++ tests/generic/group | 1 + 16 files changed, 1093 insertions(+), 1 deletion(-) create mode 100644 richacl/Makefile create mode 100755 richacl/apply-masks create mode 100755 richacl/auto-inheritance create mode 100755 richacl/basic create mode 100755 richacl/chmod create mode 100755 richacl/chown create mode 100755 richacl/create create mode 100755 richacl/ctime create mode 100755 richacl/delete create mode 100755 richacl/setrichacl-modify create mode 100644 richacl/test-lib.sh create mode 100755 richacl/write-vs-append create mode 100755 tests/generic/338
Makefile +1 -1
@@ -57,7 +57,7 @@ TOOL_SUBDIRS += dmapi endif export TESTS_DIR = tests -SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR) +SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR) richacl default: include/builddefs $(DMAPI_MAKEFILE) ifeq ($(HAVE_BUILDDEFS), no)
common/rc +32 -0
@@ -1908,6 +1908,38 @@ _require_xfs_db_command() _notrun "xfs_db $command support is missing" } +_require_scratch_richacl_xfs() +{ + _scratch_mkfs_xfs_supported -m richacl=1 >/dev/null 2>&1 \ + || _notrun "mkfs.xfs doesn't have richacl feature" + + _scratch_mkfs_xfs -m richacl=1 >/dev/null 2>&1 + _scratch_mount >/dev/null 2>&1 \ + || _notrun "kernel doesn't support richacl feature" + _scratch_unmount +} + +__require_scratch_richacl() +{ + _scratch_mkfs -O richacl >/dev/null 2>&1 \ + || _notrun "can't mkfs $FSTYP with option -O richacl" + _scratch_mount >/dev/null 2>&1 \ + || _notrun "kernel doesn't support richacl feature on $FSTYP" + _scratch_unmount +} + +_require_scratch_richacl() +{ + case "$FSTYP" in + xfs) _require_scratch_richacl_xfs + ;; + ext4) __require_scratch_richacl + ;; + *) _notrun "this test requires richacl support on \$SCRATCH_DEV" + ;; + esac +} + # check that kernel and filesystem support direct I/O _require_odirect() {
richacl/Makefile new file +23 -0
@@ -0,0 +1,23 @@ +# +# Copyright (C) 2015 Red Hat, Inc. +# + +TESTS = apply-masks basic chmod chown create delete setrichacl-modify \ + write-vs-append ctime auto-inheritance + +LSRCFILES = test-lib.sh $(TESTS) + +TOPDIR = .. +include $(TOPDIR)/include/builddefs + +TARGET_DIR = $(PKG_LIB_DIR)/richacl + +include $(BUILDRULES) + +install: + $(INSTALL) -m 755 -d $(TARGET_DIR) + $(INSTALL) -m 755 $(TESTS) $(TARGET_DIR) + $(INSTALL) -m 644 test-lib.sh $(TARGET_DIR) + +# Nothing. +install-dev install-lib:
richacl/apply-masks new file +163 -0
163 lines not on this page · raw message
richacl/auto-inheritance new file +191 -0
191 lines not on this page · raw message
richacl/basic new file +97 -0
97 lines not on this page · raw message
richacl/chmod new file +40 -0
@@ -0,0 +1,40 @@ +#! /bin/bash + +. ${0%/*}/test-lib.sh + +require_runas +require_richacls +use_testdir + +export LC_ALL=C + +# Create file as root +ncheck "touch a" + +# We cannot set the acl as another user +runas -u 99 -g 99 +check "setrichacl --set 'u:99:rwc::allow' a || echo status: \$?" <<EOF +a: Operation not permitted +status: 1 +EOF + +# We cannot chmod as another user +check "chmod 666 a || echo status: \$?" <<EOF +chmod: changing permissions of 'a': Operation not permitted +status: 1 +EOF + +# Give user 99 the write_acl permission +runas +ncheck "setrichacl --set 'u:99:rwpC::allow' a" + +# Now user 99 can setrichacl and chmod ... +runas -u 99 -g 99 +ncheck "setrichacl --set 'u:99:rwpC::allow' a" +ncheck "chmod 666 a" + +# ... but chmod disables the write_acl permission +check "setrichacl --set 'u:99:rwpC::allow' a || echo status: \$?" <<EOF +a: Operation not permitted +status: 1 +EOF
richacl/chown new file +42 -0
42 lines not on this page · raw message
richacl/create new file +36 -0
@@ -0,0 +1,36 @@ +#! /bin/bash + +. ${0%/*}/test-lib.sh + +require_runas +require_richacls +use_testdir + +export LC_ALL=C + +# Create directories as root with different permissions +ncheck "mkdir d1 d2 d3" +ncheck "setrichacl --set 'u:99:wx::allow' d2" +ncheck "setrichacl --set 'u:99:px::allow' d3" + +runas -u 99 -g 99 + +# Cannot create files or directories without permissions +check "touch d1/f || :" <<EOF +touch: cannot touch 'd1/f': Permission denied +EOF +check "mkdir d1/d || :" <<EOF +mkdir: cannot create directory 'd1/d': Permission denied +EOF + +# Can create files with add_file (w) permission +ncheck "touch d2/f" +check "mkdir d2/d || :" <<EOF +mkdir: cannot create directory 'd2/d': Permission denied +EOF + +# Can create directories with add_subdirectory (p) permission +check "touch d3/f || :" <<EOF +touch: cannot touch 'd3/f': Permission denied +EOF +ncheck "mkdir d3/d"
richacl/ctime new file +35 -0
@@ -0,0 +1,35 @@ +#! /bin/bash + +. ${0%/*}/test-lib.sh + +require_runas +require_richacls +use_testdir + +export LC_ALL=C + +ncheck "touch a" + +# Without write access, the ctime cannot be changed +runas -u 99 -g 99 +check "touch a || :" <<EOF +touch: cannot touch 'a': Permission denied +EOF + +runas +ncheck "setrichacl --set 'u:99:rw::allow' a" + +# With write access, the ctime can be set to the current time, but not to +# any other time +runas -u 99 -g 99 +ncheck "touch a" +check "touch -d '1 hour ago' a || :" <<EOF +touch: setting times of 'a': Operation not permitted +EOF + +runas +ncheck "setrichacl --set 'u:99:rwA::allow' a" + +# With set_attributes access, the ctime can be set to an arbitrary time +runas -u 99 -g 99 +ncheck "touch -d '1 hour ago' a"
richacl/delete new file +89 -0
89 lines not on this page · raw message
richacl/setrichacl-modify new file +57 -0
57 lines not on this page · raw message
richacl/test-lib.sh new file +154 -0
154 lines not on this page · raw message
richacl/write-vs-append new file +54 -0
54 lines not on this page · raw message
tests/generic/338 new file +78 -0
78 lines not on this page · raw message
tests/generic/group +1 -0
@@ -340,3 +340,4 @@ 335 auto quick metadata 336 auto quick metadata 337 auto quick metadata +338 richacl auto
Signature · 6 lines
2.5.0 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 3 lines · Andreas Gruenbacher
Hello,
here is a new version of the richacl tests.
xfstests patches need to be sent to [email protected] (added to CC list), not [email protected].
Quoted 3 lines
According to feedback from the
previous posting (http://oss.sgi.com/archives/xfs/2015-12/msg00316.html), each of the richacl tests is not run separately, on a new scratch filesystem.
Oh, my. So, you've taken this one comment:
"The rule of thumb is that there should be one xfs test per individual regression test. You've got at least 10 separate regression tests there, so there should be at least 10 xfstests. They should not be aggregated into a single test
- if you need to run them all at once, then that is what the richacl test group is for..."
And then *implemented your own execution infrastructure* so that the tests are /listed/ as separate tests in a group file but you still /run them/ as one test?
I'm almost lost for words.
It seems to me that you've ignored all the comments Eric and I have made to you about properly integrating the tests into xfstests so that they are able to be maintained by anyone who works with xfstests. Instead, you've kept most of the wacky stuff and instead made the richacl tests even more of a special snowflake than they were before.
This is not rocket science, Andreas. Both Eric and I have spelt out exactly how to convert the richacl test scripts to use xfstests scripts and infrastructure (e.g.
http://oss.sgi.com/archives/xfs/2015-11/msg00506.html), but you seem to be willfully ignoring the feedback you are being given. i.e.
- the separation of tests between richacl/<test> and tests/<fs>/<test number> is wrong. Implement the tests directly inside tests/<fs>/<test number>, using xfstests infrastructure, please.
- still not using .out files and instead are using your own internal frankenstein output matching to determine success or failure. Use the xfstests infrastructure for golden output matching, please.
- now has weird-ass richacl test execution from generic/338 and execute the tests correctly from the test harness itself. Again, use the xfstests infrastructure correctly rather than reinventing your own, please.
Most of this is as simple as copying the execution parts of your scripts to the xfstests test scripts, and the output parts of the test scripts into the test.out file. There's no new infrastructure needed for running tests, no separate richacl/ script directory, etc.
-Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 7 lines · Dave Chinner
Quoted 3 lines · Andreas Gruenbacher
Hello,
here is a new version of the richacl tests.
xfstests patches need to be sent to [email protected] (added to CC list), not [email protected].
Sorry for that.
Quoted 13 lines
Quoted 3 lines
According to feedback from the
previous posting (http://oss.sgi.com/archives/xfs/2015-12/msg00316.html), each of the richacl tests is not run separately, on a new scratch filesystem.Oh, my. So, you've taken this one comment:
"The rule of thumb is that there should be one xfs test per individual regression test. You've got at least 10 separate regression tests there, so there should be at least 10 xfstests. They should not be aggregated into a single test
- if you need to run them all at once, then that is what the richacl test group is for..."
Quoted 5 lines
And then *implemented your own execution infrastructure* so that the tests are /listed/ as separate tests in a group file but you still /run them/ as one test?
I'm almost lost for words.
What? Each test runs separately; not sure what makes you think otherwise.
Quoted 28 lines
It seems to me that you've ignored all the comments Eric and I have made to you about properly integrating the tests into xfstests so that they are able to be maintained by anyone who works with xfstests. Instead, you've kept most of the wacky stuff and instead made the richacl tests even more of a special snowflake than they were before.
This is not rocket science, Andreas. Both Eric and I have spelt out exactly how to convert the richacl test scripts to use xfstests scripts and infrastructure (e.g.
http://oss.sgi.com/archives/xfs/2015-11/msg00506.html), but you seem to be willfully ignoring the feedback you are being given. i.e.- the separation of tests between richacl/<test> and tests/<fs>/<test number> is wrong. Implement the tests directly inside tests/<fs>/<test number>, using xfstests infrastructure, please.
- still not using .out files and instead are using your own internal frankenstein output matching to determine success or failure. Use the xfstests infrastructure for golden output matching, please.
- now has weird-ass richacl test execution from generic/338 and execute the tests correctly from the test harness itself. Again, use the xfstests infrastructure correctly rather than reinventing your own, please.
Quoted 5 lines
Most of this is as simple as copying the execution parts of your scripts to the xfstests test scripts, and the output parts of the test scripts into the test.out file. There's no new infrastructure needed for running tests, no separate richacl/ script directory, etc.
I've said again and again that maintaining one set of richacl tests in xfstests and another in the richacl package is going to really painful, and that because of that, I'm trying to find a way of using the same test scripts in both places. That message obviously didn't get through at all though. That is just sad.
Andreas
Quoted 1 line · Andreas Gruenbacher
On Mon, Mar 14, 2016 at 11:24 PM, Dave Chinner <[email protected]> wrote:
<snip>
Quoted 11 lines
Quoted 5 lines
Most of this is as simple as copying the execution parts of your scripts to the xfstests test scripts, and the output parts of the test scripts into the test.out file. There's no new infrastructure needed for running tests, no separate richacl/ script directory, etc.
I've said again and again that maintaining one set of richacl tests in xfstests and another in the richacl package is going to really painful, and that because of that, I'm trying to find a way of using the same test scripts in both places. That message obviously didn't get through at all though. That is just sad.
Andreas, the issue as I see it is that xfstests is a large community project, with many users who have come to understand its implementation and its quirks^Wconventions. It is run and maintained by many people; over 150 authors have committed patches to the codebase. They understand how it all works together; it is a common language.
The way you are proposing your richacl tests integration is unlike any other tests in the codebase; you have, to some degree, spliced your own test harness into xfstests, rather than following the advice of "When in Rome, do as the Romans do."
This might make your life a little easier if you plan to maintain a separate repo of tests; in the meantime it makes life harder for the 150+ people who will be running and maintaining xfstests, not your test repo.
The advantage of xfstests is that is is a common language, warts and all. It is run by developers and qa groups all over the world. There is a learning curve, but many people have learned it. Implementing your tests in this way adds a new and unique learning curve for all those people, and will make it less likely that others will share in the maintenance burden for these new tests.
What I would suggest is that if you have tests which test only richacl userspace functionality, then perhaps you should keep them private to the richacl package. For tests which test kernel functionality, make them native to xfstests. This way you will get good coverage and maintenance help from all the people testing kernelspace with xfstests, and those hacking on richacls can run the tests local to it.
This is more or less what e2fsprogs has done, and it seems to work out ok.
-Eric
Quoted 24 lines · Andreas Gruenbacher
Quoted 7 lines · Dave Chinner
Quoted 3 lines · Andreas Gruenbacher
Hello,
here is a new version of the richacl tests.
xfstests patches need to be sent to [email protected] (added to CC list), not [email protected].
Sorry for that.
Quoted 13 lines
Quoted 3 lines
According to feedback from the
previous posting (http://oss.sgi.com/archives/xfs/2015-12/msg00316.html), each of the richacl tests is not run separately, on a new scratch filesystem.Oh, my. So, you've taken this one comment:
"The rule of thumb is that there should be one xfs test per individual regression test. You've got at least 10 separate regression tests there, so there should be at least 10 xfstests. They should not be aggregated into a single test
- if you need to run them all at once, then that is what the richacl test group is for..."
Quoted 7 lines
Quoted 5 lines
And then *implemented your own execution infrastructure* so that the tests are /listed/ as separate tests in a group file but you still /run them/ as one test?
I'm almost lost for words.
What? Each test runs separately; not sure what makes you think otherwise.
You added test generic/338, which is *not included in the group file* and so is not run by the test harness. then you added tests generic/339-348, which have a name suffix that matches the script they are supposed to run located in the richacl/ directory.
tests generic/339-348 do one thing: they execute generic/338, which then looks at the calling program name (e.g. 339-apply-masks) strips out the test number to get the script it's supposed to run. then it runs $here/richacl/apply-masks, captures all the output and only if the test fails (based on the return value of the script being run) does it dump the output of the test.
If I renumber tests on commit (which I do regularly), this magical "run test generic/338" mechanism breaks completely. It's fragile, unmaintainable and *completely unnecessary*.
Quoted 5 lines
I've said again and again that maintaining one set of richacl tests in xfstests and another in the richacl package is going to really painful, and that because of that, I'm trying to find a way of using the same test scripts in both places. That message obviously didn't get through at all though. That is just sad.
Yes, I fully understand that's what you are trying to do. I've already explained to you why your approached doesn't work for xfstests, which Eric has further explained in his response.
Once we add a test to xfstests, the author *loses control* of the test. Nobody "owns" a set of tests - anyone can modify them and we expect that *everyone* will modify them. e.g. if someone is changing some generic infrastructure, we don't expect them to have to understand that there are these magical richacl tests that you can't move or filter or change in the same way all the other hundreds of tests can be changed. All the tests need to look the same, run the same way, and be structured in the same way. Otherwise we are simply setting ourselve up with a long term maintenance nightmare.
If you really need to keep an identical copy of the tests somewhere else, then make the xfstests versions the master copy and write your own harness wrapper around the outside of those scripts. Keeping tests in standard format in xfstests is far more important to me than whether they get kept in sync with some other external package...
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]