Skip to contentSkip to conversation

Richacl tests

PATCH Superseded Andreas Gruenbacher 2 participants 5 messages Mar 16, 2016 – Mar 22, 2016

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v5 cover Richacl tests

Here we go with the richacl tests converted into "golden output matching" tests. The tests no longer consistently check the exit statuses of commands and it is more difficult to figure out which piece of output belongs to which command and to trace back from a failure to the command that has failed. Still better than nothing, though.

Andreas Gruenbacher (3):
Rename output file templates to match TEST.out*
xfs/191: Remove obsolete nfs4acl tests
generic/338-346: Add richacl tests

 .gitignore                   |  19 +++
 common/rc                    |  39 ++++++
 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/generic/338            | 117 ++++++++++++++++
 tests/generic/338.out        |  94 +++++++++++++
 tests/generic/339            | 109 +++++++++++++++
 tests/generic/339.out        | 140 +++++++++++++++++++
 tests/generic/340            |  90 ++++++++++++
 tests/generic/340.out        |  39 ++++++
 tests/generic/341            |  77 ++++++++++
 tests/generic/341.out        |   9 ++
 tests/generic/342            |  76 ++++++++++
 tests/generic/342.out        |  11 ++
 tests/generic/343            |  75 ++++++++++
 tests/generic/343.out        |  11 ++
 tests/generic/344            |  75 ++++++++++
 tests/generic/344.out        |   7 +
 tests/generic/345            | 116 ++++++++++++++++
 tests/generic/345.out        |  24 ++++
 tests/generic/346            |  80 +++++++++++
 tests/generic/346.out        |  19 +++
 tests/generic/group          |   9 ++
 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 -
 41 files changed, 1339 insertions(+), 1413 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 100755 tests/generic/338
 create mode 100644 tests/generic/338.out
 create mode 100755 tests/generic/339
 create mode 100644 tests/generic/339.out
 create mode 100755 tests/generic/340
 create mode 100644 tests/generic/340.out
 create mode 100755 tests/generic/341
 create mode 100644 tests/generic/341.out
 create mode 100755 tests/generic/342
 create mode 100644 tests/generic/342.out
 create mode 100755 tests/generic/343
 create mode 100644 tests/generic/343.out
 create mode 100755 tests/generic/344
 create mode 100644 tests/generic/344.out
 create mode 100755 tests/generic/345
 create mode 100644 tests/generic/345.out
 create mode 100755 tests/generic/346
 create mode 100644 tests/generic/346.out
 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 · 1 line
2.5.0
#1 lore raw

PATCH v5 1/3 Rename output file templates to match TEST.out*

Rename the expected output files so that they match "$TEST_NAME.out*"; this makes the file names a bit more consistent.

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
index 28fa205..f9ea1fa 100644
@@ -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
index c289c10..f949e83 100755
@@ -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 · 1 line
2.5.0
#2 lore raw

PATCH v5 2/3 xfs/191: Remove obsolete nfs4acl tests

In reply to Andreas Gruenbacher

The 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
deleted file mode 100644
index 42313f3..0000000
@@ -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
deleted file mode 100644
index f4238b0..0000000
@@ -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
deleted file mode 100644
index e140f4b..0000000
@@ -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
deleted file mode 100644
index 614d79b..0000000
@@ -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
deleted file mode 100644
index 17fe5d4..0000000
@@ -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
index e0c4553..2bc2db4 100644
@@ -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 · 1 line
2.5.0
#3 lore raw

PATCH v5 3/3 generic/338-346: Add richacl tests

In reply to Andreas Gruenbacher
---
 common/rc             |  39 ++++++++++++++
 tests/generic/338     | 117 +++++++++++++++++++++++++++++++++++++++++
 tests/generic/338.out |  94 +++++++++++++++++++++++++++++++++
 tests/generic/339     | 109 +++++++++++++++++++++++++++++++++++++++
 tests/generic/339.out | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/340     |  90 ++++++++++++++++++++++++++++++++
 tests/generic/340.out |  39 ++++++++++++++
 tests/generic/341     |  77 +++++++++++++++++++++++++++
 tests/generic/341.out |   9 ++++
 tests/generic/342     |  76 +++++++++++++++++++++++++++
 tests/generic/342.out |  11 ++++
 tests/generic/343     |  75 +++++++++++++++++++++++++++
 tests/generic/343.out |  11 ++++
 tests/generic/344     |  75 +++++++++++++++++++++++++++
 tests/generic/344.out |   7 +++
 tests/generic/345     | 116 +++++++++++++++++++++++++++++++++++++++++
 tests/generic/345.out |  24 +++++++++
 tests/generic/346     |  80 +++++++++++++++++++++++++++++
 tests/generic/346.out |  19 +++++++
 tests/generic/group   |   9 ++++
 20 files changed, 1217 insertions(+)
 create mode 100755 tests/generic/338
 create mode 100644 tests/generic/338.out
 create mode 100755 tests/generic/339
 create mode 100644 tests/generic/339.out
 create mode 100755 tests/generic/340
 create mode 100644 tests/generic/340.out
 create mode 100755 tests/generic/341
 create mode 100644 tests/generic/341.out
 create mode 100755 tests/generic/342
 create mode 100644 tests/generic/342.out
 create mode 100755 tests/generic/343
 create mode 100644 tests/generic/343.out
 create mode 100755 tests/generic/344
 create mode 100644 tests/generic/344.out
 create mode 100755 tests/generic/345
 create mode 100644 tests/generic/345.out
 create mode 100755 tests/generic/346
 create mode 100644 tests/generic/346.out
common/rc +39 -0
index 16f5a43..d7472fc 100644
@@ -1973,6 +1973,45 @@ _require_seek_data_hole()
         _notrun "File system does not support llseek(2) SEEK_DATA/HOLE"
 }
 
+_require_richacl()
+{
+	GETRICHACL_PROG=`set_prog_path getrichacl`
+	_require_command "$GETRICHACL_PROG" getrichacl
+	SETRICHACL_PROG=`set_prog_path setrichacl`
+	_require_command "$SETRICHACL_PROG" setrichacl
+}
+
+_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 on $FSTYP"
+}
+
+__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()
+{
+	_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 a FS on a device is mounted
 # if so, return mount point
 #
tests/generic/338 new file +117 -0

117 lines not on this page · raw message

tests/generic/338.out new file +94 -0

94 lines not on this page · raw message

tests/generic/339 new file +109 -0

109 lines not on this page · raw message

tests/generic/339.out new file +140 -0

140 lines not on this page · raw message

tests/generic/340 new file +90 -0

90 lines not on this page · raw message

tests/generic/340.out new file +39 -0
new file mode 100644
index 0000000..f0874b0
@@ -0,0 +1,39 @@
+QA output created by 340
+-rw-rw-rw-
+x:
+ everyone@:rwp----------::allow
+
+-rw-rw-r--
+x:
+    owner@:rwp----------::allow
+    group@:rwp----------::allow
+ everyone@:r------------::allow
+
+drwxrwxrwx+
+# file: sub
+system.richacl
+
+drwxrwxr-x+
+# file: sub
+system.richacl
+
+sub:
+    owner@:rwpxd--------::allow
+    group@:rwpxd--------::allow
+ everyone@:rwpxd--------:fdi:allow
+ everyone@:r--x---------::allow
+
+-rw-rw-rw-
+sub/f:
+ everyone@:rwp----------::allow
+
+drwxrwxrwx+
+sub/sub2:
+ everyone@:rwpxd--------:fd:allow
+
+drwxr-x---+
+sub/sub3:
+    owner@:rwpxd--------::allow
+    group@:r--x---------::allow
+ everyone@:rwpxd--------:fdi:allow
+
tests/generic/341 new file +77 -0

77 lines not on this page · raw message

tests/generic/341.out new file +9 -0
new file mode 100644
index 0000000..6c5855c
@@ -0,0 +1,9 @@
+QA output created by 341
+--- runas -u 99 -g 99 setrichacl --set u:99:rwc::allow a
+a: Operation not permitted
+--- runas -u 99 -g 99 chmod 666 a
+chmod: changing permissions of 'a': Operation not permitted
+--- runas -u 99 -g 99 setrichacl --set u:99:rwpC::allow a
+--- runas -u 99 -g 99 chmod 666 a
+--- runas -u 99 -g 99 setrichacl --set u:99:rwpC::allow a
+a: Operation not permitted
tests/generic/342 new file +76 -0

76 lines not on this page · raw message

tests/generic/342.out new file +11 -0
new file mode 100644
index 0000000..db1eceb
@@ -0,0 +1,11 @@
+QA output created by 342
+--- runas -u 99 -g 99 chown 99 a
+chown: changing ownership of 'a': Operation not permitted
+--- runas -u 99 -g 99 chgrp 99 a
+chgrp: changing group of 'a': Operation not permitted
+--- runas -u 99 -g 99 chown 100 a
+chown: changing ownership of 'a': Operation not permitted
+--- runas -u 99 -g 99 chgrp 100 a
+chgrp: changing group of 'a': Operation not permitted
+--- runas -u 99 -g 99 chown 99 a
+--- runas -u 99 -g 99 chgrp 99 a
tests/generic/343 new file +75 -0

75 lines not on this page · raw message

tests/generic/343.out new file +11 -0
new file mode 100644
index 0000000..bb028f5
@@ -0,0 +1,11 @@
+QA output created by 343
+--- runas -u 99 -g 99 touch d1/f
+touch: cannot touch 'd1/f': Permission denied
+--- runas -u 99 -g 99 mkdir d1/d
+mkdir: cannot create directory 'd1/d': Permission denied
+--- runas -u 99 -g 99 touch d2/f
+--- runas -u 99 -g 99 mkdir d2/d
+mkdir: cannot create directory 'd2/d': Permission denied
+--- runas -u 99 -g 99 touch d3/f
+touch: cannot touch 'd3/f': Permission denied
+--- runas -u 99 -g 99 mkdir d3/d
tests/generic/344 new file +75 -0

75 lines not on this page · raw message

tests/generic/344.out new file +7 -0
new file mode 100644
index 0000000..029c5ec
@@ -0,0 +1,7 @@
+QA output created by 344
+--- runas -u 99 -g 99 touch a
+touch: cannot touch 'a': Permission denied
+--- runas -u 99 -g 99 touch a
+--- runas -u 99 -g 99 touch -d 1 hour ago a
+touch: setting times of 'a': Operation not permitted
+--- runas -u 99 -g 99 touch -d 1 hour ago a
tests/generic/345 new file +116 -0

116 lines not on this page · raw message

tests/generic/345.out new file +24 -0
new file mode 100644
index 0000000..8701dcf
@@ -0,0 +1,24 @@
+QA output created by 345
+--- runas -u 99 -g 99 rm -f d1/f d1/g
+rm: cannot remove 'd1/f': Permission denied
+rm: cannot remove 'd1/g': Permission denied
+--- runas -u 99 -g 99 rm -f d2/f s2/f
+--- runas -u 99 -g 99 rm -f d3/f s3/f
+rm: cannot remove 's3/f': Operation not permitted
+--- runas -u 99 -g 99 rm -f d4/f s4/f
+rm: cannot remove 'd4/f': Permission denied
+rm: cannot remove 's4/f': Permission denied
+--- runas -u 99 -g 99 rm -f d5/f s5/f
+rm: cannot remove 'd5/f': Permission denied
+rm: cannot remove 's5/f': Permission denied
+--- runas -u 99 -g 99 rm -f d6/f s6/f
+rm: cannot remove 's6/f': Operation not permitted
+--- runas -u 99 -g 99 rm -f d7/f s7/f
+--- runas -u 99 -g 99 touch h
+--- runas -u 99 -g 99 mv -f h d7/
+mv: cannot move 'h' to 'd7/h': Permission denied
+--- runas -u 99 -g 99 mv -f h s7/
+mv: cannot move 'h' to 's7/h': Permission denied
+--- runas -u 99 -g 99 rm -f d7/g s7/g
+rm: cannot remove 'd7/g': Permission denied
+rm: cannot remove 's7/g': Permission denied
tests/generic/346 new file +80 -0

80 lines not on this page · raw message

tests/generic/346.out new file +19 -0
new file mode 100644
index 0000000..3dfc445
@@ -0,0 +1,19 @@
+QA output created by 346
+--- runas -u 99 -g 99 sh -c echo a > a
+sh: a: Permission denied
+--- runas -u 99 -g 99 sh -c echo b > b
+--- runas -u 99 -g 99 sh -c echo c > c
+sh: c: Permission denied
+--- runas -u 99 -g 99 sh -c echo d > d
+--- runas -u 99 -g 99 sh -c echo e > e
+--- runas -u 99 -g 99 sh -c echo f > f
+sh: f: Permission denied
+--- runas -u 99 -g 99 sh -c echo A >> a
+sh: a: Permission denied
+--- runas -u 99 -g 99 sh -c echo B >> b
+sh: b: Permission denied
+--- runas -u 99 -g 99 sh -c echo C >> c
+--- runas -u 99 -g 99 sh -c echo D >> d
+--- runas -u 99 -g 99 sh -c echo E >> e
+sh: e: Permission denied
+--- runas -u 99 -g 99 sh -c echo F >> f
tests/generic/group +9 -0
index 727648c..e892ae9 100644
@@ -340,3 +340,12 @@
 335 auto quick metadata
 336 auto quick metadata
 337 auto quick metadata
+338 auto richacl
+339 auto richacl
+340 auto richacl
+341 auto richacl
+342 auto richacl
+343 auto richacl
+344 auto richacl
+345 auto richacl
+346 auto richacl
Signature · 1 line
2.5.0
#4 lore raw

Re: [PATCH v5 3/3] generic/338-346: Add richacl tests

Quoted 29 lines · Andreas Gruenbacher
common/rc +28 -0
+_require_richacl()
+{
+	GETRICHACL_PROG=`set_prog_path getrichacl`
+	_require_command "$GETRICHACL_PROG" getrichacl
+	SETRICHACL_PROG=`set_prog_path setrichacl`
+	_require_command "$SETRICHACL_PROG" setrichacl
+}
+
+_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 on $FSTYP"
+}
+
+__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()
+{

common/rc _require_seek_data_hole() · line 2013

Quoted 10 lines
common/rc +10 -0
+	_require_scratch
+	case "$FSTYP" in
+	xfs)    _setup_scratch_richacl_xfs
+		;;
+	ext4)   __setup_scratch_richacl
+		;;
+	*)      _notrun "this test requires richacl support on \$SCRATCH_DEV"
+		;;
+	esac
+}

These are all _require functions. Please don't combine test requirements with initial test condition setup, nor hide requirements inside other requirements. If a test runs some other _require_scratch_foo() after these richacl checks, then the scratch device wil be in an undefined state. IOws, these functions are:

_require_richacl_prog()
_require_scratch_richacl_xfs()
_require_scratch_richacl_ext4()
_require_scratch_richacl()
_scratch_mkfs_richacl()

And the test needs to do this as setup:

_require_scratch
_require_scratch_richacl
_require_richacl_prog

_scratch_mkfs_richacl
_scratch_mount

Quoted 4 lines

new file mode 100755
index 0000000..88e4141

tests/generic/343 new file +0 -0

.....

Quoted 7 lines
tests/generic/343 new file +7 -0
+
+# get standard environment, filters and checks
+. ./common/rc
+
+# real QA test starts here
+
+_supported_fs generic

tests/generic/343

Quoted 10 lines
tests/generic/343 new file +10 -0
+_supported_os Linux
+_require_richacl
+_setup_scratch_richacl
+
+cd $SCRATCH_MNT
+
+r() {
+	echo "--- runas -u 99 -g 99 $*"
+	$here/src/runas -u 99 -g 99 -- "$@"
+}

Need to add _require_runas here, and generic/026, generic/093, generic/237 and shared/051 also need their open coded checks for the executable changed to _require_runas. (multiple tests in this patch need this).

Quoted 7 lines
tests/generic/group +0 -0
index 727648c..e892ae9 100644
@@ -340,3 +340,12 @@
 335 auto quick metadata
 336 auto quick metadata

tests/generic/group line 351

Quoted 10 lines
tests/generic/group +9 -0
 337 auto quick metadata
+338 auto richacl
+339 auto richacl
+340 auto richacl
+341 auto richacl
+342 auto richacl
+343 auto richacl
+344 auto richacl
+345 auto richacl
+346 auto richacl

MOst of thse tests take only a couple of seconds to run, right? If so, then they should probably also be in the quick group.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]