All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH] fs/acls: fix some permission issue in the testcase
Date: Mon,  9 Mar 2015 17:43:13 +0800	[thread overview]
Message-ID: <1425894193-17523-1-git-send-email-liwang@redhat.com> (raw)

hi,

The acl_test01 failed with a series of permission issue when runing on RHEL:
	useradd: cannot set SELinux context for home directory
	/mnt/testarea/ltp-KIK01kZbbL/tacl/mount-ext3/acltest1
	Could not add test user acltest1.
	/dev/loop1 on /mnt/testarea/ltp-KIK01kZbbL/tacl/mount-ext3
	type ext3 (rw,relatime,seclabel,data=ordered)
	...

A proposal fixed patch and test results as below:

	TESTING ACLS FOR USER root
	Trying extended acls for files
	Extended acls for files (PASSED)
	Trying extended acls for file links
	Extended acls for links (PASSED)

	TESTING ACLS FOR 2ND USER acltest1
	Trying extended acls for files
	Extended acls for files (PASSED)
	Trying extended acls for file links
	Extended acls for links (PASSED)
	...

Thanks.

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/fs/acls/acl_test01 | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/fs/acls/acl_test01 b/testcases/kernel/fs/acls/acl_test01
index af65213..5aa5823 100755
--- a/testcases/kernel/fs/acls/acl_test01
+++ b/testcases/kernel/fs/acls/acl_test01
@@ -52,15 +52,30 @@ FILE_ACL="$TMP/tacl/mount-ext3/test_file"
 FILE_ACL_LINK="$TMP/tacl/mount-ext3/test_file_link"
 TCbin=`pwd`
 
+SESTATUS=`/usr/sbin/sestatus |grep "SELinux status"|awk '{print $3}'`
+if [ "$SESTATUS" = "enabled" ]; then
+	export SELINUX=`getenforce`
+else
+	export SELINUX="disabled"
+
+fi
+
 #-----------------------------------------------------------------------
 # FUNCTION:  do_setup
 #-----------------------------------------------------------------------
 
 do_setup(){
 
+	tst_require_root
+
 	rm -f $FILE_ACL
 	rm -f $FILE_ACL_LINK
 
+	if [ "$SELINUX" = "Enforcing" ]; then
+		echo "set the SElinux to Permissive."
+		setenforce 0
+	fi
+
 	if [ "x$TEST_USER1_HOMEDIR" = "x" ]; then
 		echo "Could not find user $TEST_USER1's home directory."
 		exit 1
@@ -91,6 +106,11 @@ do_cleanup() {
 	mount | grep "$TMP/tacl/mount-ext3" && umount -d $TMP/tacl/mount-ext3
 	[ "x$LOOP_DEV" != x ] && losetup -d $LOOP_DEV
 	rm -rf $TMP/tacl
+
+	if [ "$SELNUX" = "Enforcing" ]; then
+		echo "set the SElinux to Enforcing."
+		setenforce 1
+	fi
 }
 
 #-----------------------------------------------------------------------
@@ -177,7 +197,7 @@ then
 	setfacl -m u:$TEST_USER1:r $FILE_ACL
 
 	echo "Trying extended acls for files"
-	${TCbin}/acl_file_test $FILE_ACL
+	$TMP/tacl/mount-ext3/acl_file_test $FILE_ACL
 	if [ $? -ne 0 ]
 	then
 		EXIT_CODE=1
@@ -187,7 +207,7 @@ then
 	fi
 
 	echo "Trying extended acls for file links"
-	${TCbin}/acl_link_test $FILE_ACL_LINK
+	$TMP/tacl/mount-ext3/acl_link_test $FILE_ACL_LINK
 	if [ $? -ne 0 ]
 	then
 		EXIT_CODE=1
@@ -227,6 +247,7 @@ else
 		echo "Extended acls for links (PASSED)"
 	fi
 
+	cp ${TCbin}/acl_link_test ${TCbin}/acl_file_test $TMP/tacl/mount-ext3/
 	chown $TEST_USER1 $FILE_ACL
 	chown $TEST_USER1 $FILE_ACL_LINK
 
-- 
1.8.3.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

             reply	other threads:[~2015-03-09  9:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-09  9:43 Li Wang [this message]
2015-03-09 12:19 ` [LTP] [PATCH] fs/acls: fix some permission issue in the testcase wangli
2015-03-10  2:22 ` Zeng Linggang
2015-03-10  3:04   ` Li Wang

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=1425894193-17523-1-git-send-email-liwang@redhat.com \
    --to=liwang@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.