From: Andreas Gruenbacher <agruenba@redhat.com>
To: fstests@vger.kernel.org
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Subject: [PATCH v6 3/3] generic/093,099,237 shared/051: Switch to _require_runas
Date: Tue, 31 May 2016 22:18:51 +0200 [thread overview]
Message-ID: <1464725931-27588-3-git-send-email-agruenba@redhat.com> (raw)
In-Reply-To: <1464725931-27588-1-git-send-email-agruenba@redhat.com>
Use _require_runas and the runas function instead of open-coding those.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
tests/generic/093 | 14 ++++++--------
tests/generic/099 | 45 +++++++++++++++++++++------------------------
tests/generic/237 | 6 ++----
tests/shared/051 | 48 +++++++++++++++++++++++-------------------------
4 files changed, 52 insertions(+), 61 deletions(-)
diff --git a/tests/generic/093 b/tests/generic/093
index af58888..da067c6 100755
--- a/tests/generic/093
+++ b/tests/generic/093
@@ -30,7 +30,6 @@ seqres=$RESULT_DIR/$seq
here=`pwd`
tmp=/tmp/$$
-runas=$here/src/runas
status=1 # FAILure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -60,8 +59,7 @@ _supported_os IRIX
_require_test
_require_attrs
-
-[ -x $runas ] || _notrun "$runas executable not found"
+_require_runas
rm -f $seqres.full
@@ -101,7 +99,7 @@ echo "----"
echo "append to file as user without caps"
# in particular user doesn't have FSETID or SETFCAP
-$runas -u $uid $tmp.append
+runas -u $uid $tmp.append
echo "cat file"
echo "----"
@@ -113,7 +111,7 @@ ls -P $file | _testfilter
# try again when it doesn't have the EA
echo "append to file as user without caps a 2nd time"
-$runas -u $uid $tmp.append
+runas -u $uid $tmp.append
echo "ls -P on file"
ls -P $file | _testfilter
@@ -128,7 +126,7 @@ chmod 700 $file
chown root $file
echo "as non-root try to append to file"
-$runas -u $uid $tmp.append 2>&1 | _filefilter
+runas -u $uid $tmp.append 2>&1 | _filefilter
echo "restore perms on file"
chmod 777 $file
@@ -140,7 +138,7 @@ echo "list EA on file"
${ATTR_PROG} -R -l $file | _filefilter
echo "as non-root try to append to file"
-$runas -u $uid $tmp.append 2>&1 | _filefilter
+runas -u $uid $tmp.append 2>&1 | _filefilter
echo "list EA on file"
${ATTR_PROG} -R -l $file | _filefilter
@@ -148,7 +146,7 @@ ${ATTR_PROG} -R -l $file | _filefilter
chown $uid $file
chmod ugo+w $TEST_DIR
echo "as non-root call writemod"
-$runas -u $uid src/writemod $file 2>&1 | _filefilter
+runas -u $uid src/writemod $file 2>&1 | _filefilter
echo "cat file"
echo "----"
diff --git a/tests/generic/099 b/tests/generic/099
index b544fe2..a4f54b9 100755
--- a/tests/generic/099
+++ b/tests/generic/099
@@ -37,8 +37,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
. ./common/filter
. ./common/attr
-runas=$here/src/runas
-
TARGET_DIR=$SCRATCH_MNT
[ "$FSTYP" == "xfs" ] && TARGET_DIR=$TEST_DIR
@@ -83,8 +81,7 @@ _supported_os IRIX
_require_test
_acl_setup_ids
_require_acls
-
-[ -x $runas ] || _notrun "$runas executable not found"
+_require_runas
# get dir
#export FILE_SYS=xfs
@@ -137,35 +134,35 @@ chacl u::r-x,g::---,o::--- file1 2>&1
_acl_list file1
# change to owner
echo "Expect to PASS"
-$runas -u $acl1 -g $acl1 ./file1 2>&1
+runas -u $acl1 -g $acl1 ./file1 2>&1
echo "Expect to FAIL"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
echo ""
echo "--- Test group permissions ---"
chacl u::---,g::r-x,o::--- file1 2>&1
_acl_list file1
echo "Expect to FAIL - acl1 is owner"
-$runas -u $acl1 -g $acl1 ./file1 2>&1
+runas -u $acl1 -g $acl1 ./file1 2>&1
echo "Expect to PASS - acl2 matches group"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
echo "Expect to PASS - acl2 matches sup group"
-$runas -u $acl2 -g $acl3 -s $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl3 -s $acl2 ./file1 2>&1
echo "Expect to FAIL - acl3 is not in group"
-$runas -u $acl3 -g $acl3 ./file1 2>&1
+runas -u $acl3 -g $acl3 ./file1 2>&1
echo ""
echo "--- Test other permissions ---"
chacl u::---,g::---,o::r-x file1 2>&1
_acl_list file1
echo "Expect to FAIL - acl1 is owner"
-$runas -u $acl1 -g $acl1 ./file1 2>&1
+runas -u $acl1 -g $acl1 ./file1 2>&1
echo "Expect to FAIL - acl2 is in group"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
echo "Expect to FAIL - acl2 is in sup. group"
-$runas -u $acl2 -g $acl3 -s $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl3 -s $acl2 ./file1 2>&1
echo "Expect to PASS - acl3 is not owner or in group"
-$runas -u $acl3 -g $acl3 ./file1 2>&1
+runas -u $acl3 -g $acl3 ./file1 2>&1
#-------------------------------------------------------
@@ -181,9 +178,9 @@ _acl_list file1
echo "Expect to PASS - USER ACE matches user"
chacl u::---,g::---,o::---,u:$acl2:r-x,m::rwx file1 2>&1
_acl_list file1
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
echo "Expect to FAIL - USER ACE does not match user"
-$runas -u $acl3 -g $acl3 ./file1 2>&1
+runas -u $acl3 -g $acl3 ./file1 2>&1
echo ""
echo "--- Test adding a GROUP ACE ---"
@@ -194,11 +191,11 @@ _acl_list file1
chacl u::---,g::---,o::---,g:$acl2:r-x,m::rwx file1 2>&1
_acl_list file1 | _acl_filter_id
echo "Expect to PASS - GROUP ACE matches group"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
echo "Expect to PASS - GROUP ACE matches sup group"
-$runas -u $acl2 -g $acl1 -s $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl1 -s $acl2 ./file1 2>&1
echo "Expect to FAIL - GROUP ACE does not match group"
-$runas -u $acl3 -g $acl3 ./file1 2>&1
+runas -u $acl3 -g $acl3 ./file1 2>&1
#-------------------------------------------------------
@@ -209,17 +206,17 @@ echo "--- Test MASK ---"
chacl u::---,g::---,o::---,g:$acl2:r-x,m::-w- file1 2>&1
_acl_list file1
echo "Expect to FAIL as MASK prohibits execution"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
# user
chacl u::---,g::---,o::---,u:$acl2:r-x,m::-w- file1 2>&1
echo "Expect to FAIL as MASK prohibits execution"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
# user
chacl u::---,g::---,o::---,u:$acl2:r-x,m::r-x file1 2>&1
echo "Expect to PASS as MASK allows execution"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
#-------------------------------------------------------
@@ -228,11 +225,11 @@ echo "--- Test ACE priority ---"
chacl o::rwx,g::rwx,u:$acl1:rwx,u::---,m::rwx file1 2>&1
echo "Expect to FAIL as should match on owner"
-$runas -u $acl1 -g $acl2 ./file1 2>&1
+runas -u $acl1 -g $acl2 ./file1 2>&1
chacl o::---,g::---,u:$acl2:rwx,u::---,m::rwx file1 2>&1
echo "Expect to PASS as should match on user"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
#-------------------------------------------------------
diff --git a/tests/generic/237 b/tests/generic/237
index 75b1b55..82329da 100755
--- a/tests/generic/237
+++ b/tests/generic/237
@@ -29,7 +29,6 @@ echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
-runas=$here/src/runas
status=1 # FAILure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -50,8 +49,7 @@ _supported_fs generic
# only Linux supports fallocate
_supported_os Linux
_require_test
-
-[ -x $runas ] || _notrun "$runas executable not found"
+_require_runas
rm -f $seqres.full
@@ -68,7 +66,7 @@ touch file1
chown $acl1.$acl1 file1
echo "Expect to FAIL"
-$runas -u $acl2 -g $acl2 -- setfacl -m u::rwx file1 2>&1 | sed 's/^setfacl: \/.*file1: Operation not permitted$/setfacl: file1: Operation not permitted/'
+runas -u $acl2 -g $acl2 -- setfacl -m u::rwx file1 2>&1 | sed 's/^setfacl: \/.*file1: Operation not permitted$/setfacl: file1: Operation not permitted/'
echo "Test over."
# success, all done
diff --git a/tests/shared/051 b/tests/shared/051
index 1b2d2cf..f219750 100755
--- a/tests/shared/051
+++ b/tests/shared/051
@@ -27,7 +27,6 @@ seqres=$RESULT_DIR/$seq
here=`pwd`
tmp=/tmp/$$
-runas=$here/src/runas
status=1 # FAILure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -71,8 +70,7 @@ _cleanup()
_supported_fs xfs udf
_supported_os Linux
_require_test
-
-[ -x $runas ] || _notrun "$runas executable not found"
+_require_runas
rm -f $seqres.full
@@ -128,35 +126,35 @@ chacl u::r-x,g::---,o::--- file1 2>&1
chacl -l file1 | _acl_filter_id
# change to owner
echo "Expect to PASS"
-$runas -u $acl1 -g $acl1 ./file1 2>&1
+runas -u $acl1 -g $acl1 ./file1 2>&1
echo "Expect to FAIL"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
echo ""
echo "--- Test group permissions ---"
chacl u::---,g::r-x,o::--- file1 2>&1
chacl -l file1 | _acl_filter_id
echo "Expect to FAIL - acl1 is owner"
-$runas -u $acl1 -g $acl1 ./file1 2>&1
+runas -u $acl1 -g $acl1 ./file1 2>&1
echo "Expect to PASS - acl2 matches group"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
echo "Expect to PASS - acl2 matches sup group"
-$runas -u $acl2 -g $acl3 -s $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl3 -s $acl2 ./file1 2>&1
echo "Expect to FAIL - acl3 is not in group"
-$runas -u $acl3 -g $acl3 ./file1 2>&1
+runas -u $acl3 -g $acl3 ./file1 2>&1
echo ""
echo "--- Test other permissions ---"
chacl u::---,g::---,o::r-x file1 2>&1
chacl -l file1 | _acl_filter_id
echo "Expect to FAIL - acl1 is owner"
-$runas -u $acl1 -g $acl1 ./file1 2>&1
+runas -u $acl1 -g $acl1 ./file1 2>&1
echo "Expect to FAIL - acl2 is in group"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
echo "Expect to FAIL - acl2 is in sup. group"
-$runas -u $acl2 -g $acl3 -s $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl3 -s $acl2 ./file1 2>&1
echo "Expect to PASS - acl3 is not owner or in group"
-$runas -u $acl3 -g $acl3 ./file1 2>&1
+runas -u $acl3 -g $acl3 ./file1 2>&1
#-------------------------------------------------------
@@ -172,9 +170,9 @@ chacl -l file1 | _acl_filter_id
echo "Expect to PASS - USER ACE matches user"
chacl u::---,g::---,o::---,u:$acl2:r-x,m::rwx file1 2>&1
chacl -l file1 | _acl_filter_id
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
echo "Expect to FAIL - USER ACE does not match user"
-$runas -u $acl3 -g $acl3 ./file1 2>&1
+runas -u $acl3 -g $acl3 ./file1 2>&1
echo ""
echo "--- Test adding a GROUP ACE ---"
@@ -185,11 +183,11 @@ chacl -l file1 | _acl_filter_id
chacl u::---,g::---,o::---,g:$acl2:r-x,m::rwx file1 2>&1
chacl -l file1 | _acl_filter_id
echo "Expect to PASS - GROUP ACE matches group"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
echo "Expect to PASS - GROUP ACE matches sup group"
-$runas -u $acl2 -g $acl1 -s $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl1 -s $acl2 ./file1 2>&1
echo "Expect to FAIL - GROUP ACE does not match group"
-$runas -u $acl3 -g $acl3 ./file1 2>&1
+runas -u $acl3 -g $acl3 ./file1 2>&1
#-------------------------------------------------------
@@ -200,17 +198,17 @@ echo "--- Test MASK ---"
chacl u::---,g::---,o::---,g:$acl2:r-x,m::-w- file1 2>&1
chacl -l file1 | _acl_filter_id
echo "Expect to FAIL as MASK prohibits execution"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
# user
chacl u::---,g::---,o::---,u:$acl2:r-x,m::-w- file1 2>&1
echo "Expect to FAIL as MASK prohibits execution"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
# user
chacl u::---,g::---,o::---,u:$acl2:r-x,m::r-x file1 2>&1
echo "Expect to PASS as MASK allows execution"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
#-------------------------------------------------------
@@ -219,11 +217,11 @@ echo "--- Test ACE priority ---"
chacl o::rwx,g::rwx,u:$acl1:rwx,u::---,m::rwx file1 2>&1
echo "Expect to FAIL as should match on owner"
-$runas -u $acl1 -g $acl2 ./file1 2>&1
+runas -u $acl1 -g $acl2 ./file1 2>&1
chacl o::---,g::---,u:$acl2:rwx,u::---,m::rwx file1 2>&1
echo "Expect to PASS as should match on user"
-$runas -u $acl2 -g $acl2 ./file1 2>&1
+runas -u $acl2 -g $acl2 ./file1 2>&1
#-------------------------------------------------------
@@ -293,10 +291,10 @@ done
popd >/dev/null
chown -R 12345.54321 root
echo "Change #1..."
-$runas -u 12345 -g 54321 -- chacl -r u::rwx,g::-w-,o::--x root
+runas -u 12345 -g 54321 -- chacl -r u::rwx,g::-w-,o::--x root
find root -print | xargs chacl -l
echo "Change #2..."
-$runas -u 12345 -g 54321 -- chacl -r u::---,g::---,o::--- root
+runas -u 12345 -g 54321 -- chacl -r u::---,g::---,o::--- root
find root -print | xargs chacl -l
#-------------------------------------------------------
--
2.5.5
next prev parent reply other threads:[~2016-05-31 20:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 20:18 [PATCH v6 1/3] generic/352-360: Add richacl tests Andreas Gruenbacher
2016-05-31 20:18 ` [PATCH v6 2/3] generic/026: This test doesn't require runas Andreas Gruenbacher
2016-06-23 9:55 ` Eryu Guan
2016-05-31 20:18 ` Andreas Gruenbacher [this message]
2016-06-23 9:51 ` [PATCH v6 1/3] generic/352-360: Add richacl tests Eryu Guan
2016-06-27 22:39 ` Andreas Gruenbacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464725931-27588-3-git-send-email-agruenba@redhat.com \
--to=agruenba@redhat.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox