All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [LTP] [PATCH v3] fs/acls: fix some permission issue in the testcase
       [not found] <1426158755-20918-1-git-send-email-liwang@redhat.com>
@ 2015-04-14 10:13 ` Li Wang
  2015-04-22 14:42 ` Cyril Hrubis
  1 sibling, 0 replies; 2+ messages in thread
From: Li Wang @ 2015-04-14 10:13 UTC (permalink / raw)
  To: ltp-list

Hi, 

Ping~

-- 
Regards, 
Li Wang 
Email: liwang@redhat.com 


----- Original Message -----
> * Use 'test.sh'.
> 
> * Do some cleanup.
> 
> * Remove useless changes.
> 
> * Check the getenforce/setenforce command exist or not.
> 
> * Waive the consideration of SElinux Disabled or Permitive situation.
> 
> Signed-off-by: Li Wang <liwang@redhat.com>
> Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
>  testcases/kernel/fs/acls/acl_test01 | 69
>  +++++++++++++++++++++----------------
>  1 file changed, 40 insertions(+), 29 deletions(-)
> 
> diff --git a/testcases/kernel/fs/acls/acl_test01
> b/testcases/kernel/fs/acls/acl_test01
> index af65213..fb08ce3 100755
> --- a/testcases/kernel/fs/acls/acl_test01
> +++ b/testcases/kernel/fs/acls/acl_test01
> @@ -41,6 +41,8 @@ export TCID=acltest01
>  export TST_TOTAL=5
>  export TST_COUNT=1
>  
> +. test.sh
> +
>  TMP=${TMP:=/tmp}
>  
>  TEST_USER1="acltest1"
> @@ -52,18 +54,33 @@ FILE_ACL="$TMP/tacl/mount-ext3/test_file"
>  FILE_ACL_LINK="$TMP/tacl/mount-ext3/test_file_link"
>  TCbin=`pwd`
>  
> +COMMAND=$(command -v "getenforce" "setenforce" |wc -l)
> +if [ $COMMAND -eq 2 ]; then
> +	SELINUX=$(getenforce)
> +else
> +	SELINUX=""
> +fi
> +
>  #-----------------------------------------------------------------------
>  # FUNCTION:  do_setup
>  #-----------------------------------------------------------------------
>  
>  do_setup(){
>  
> +	tst_require_root
> +
>  	rm -f $FILE_ACL
>  	rm -f $FILE_ACL_LINK
>  
> +	# We couldn't consider whether the SElinux is Disable or Permissive.
> +	# We only set it to Permissive when it it Enforcing.
> +	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
> +		tst_brkm TBROK "Could not find user $TEST_USER1's home directory."
>  	fi
>  
>  	# XXX (garrcoop): why is cleanup junk being done in setup??? Bad test!!!
> @@ -73,8 +90,7 @@ do_setup(){
>  	useradd -d $TEST_USER1_HOMEDIR -m -g $TEST_USER1_GROUP $TEST_USER1 -s
>  	/bin/sh
>  
>  	if [ $? -ne 0 ]; then
> -		echo "Could not add test user $TEST_USER1."
> -		exit 1
> +		tst_brkm TBROK "Could not add test user $TEST_USER1."
>  	fi
>  
>  }
> @@ -91,6 +107,12 @@ 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
> +
> +	# We set it back to Enforcing.
> +	if [ "$SELINUX" = "Enforcing" ]; then
> +		echo "set the SElinux back to Enforcing."
> +		setenforce 1
> +	fi
>  }
>  
>  #-----------------------------------------------------------------------
> @@ -102,14 +124,10 @@ if [ "z$iam" = "z$TEST_USER1" ]
>  then
>  	echo ""
>  else
> -	if [ $(id -ru) != 0 ]; then
> -		tst_resm TCONF "must be root to execute this script"
> -		exit 0
> -	fi
> +	tst_require_root
>  
>  	if ! ( test -d $TMP/tacl || mkdir -m 777 $TMP/tacl) ; then
> -		tst_resm TCONF "failed to create $TMP/tacl directory."
> -		exit 1
> +		tst_brkm TBROK "Failed to create $TMP/tacl directory."
>  	fi
>  
>  	trap do_cleanup EXIT
> @@ -119,21 +137,18 @@ else
>  
>  	dd if=/dev/zero of=$TMP/tacl/blkext3 bs=1k count=10240 && chmod 777
>  	$TMP/tacl/blkext3
>  	if [ $? -ne 0 ] ; then
> -		tst_resm TCONF "Failed to create $TMP/tacl/blkext3"
> -		exit 0
> +		tst_brkm TBROK "Failed to create $TMP/tacl/blkext3"
>  	fi
>  
>  	# Avoid hardcoded loopback device values (-f tries to find the first
>  	# available loopback device name)!
>  	if ! LOOP_DEV=$(losetup -f) || [ "x$LOOP_DEV" = x ]; then
> -		tst_resm TCONF "[ losetup.1 ] Failed to find an available loopback device
> -- is the required support compiled in your kernel?"
> -		exit 0
> +		tst_brkm TCONF "[ losetup.1 ] Failed to find an available loopback device
> -- is the required support compiled in your kernel?"
>  	fi
>  
>  	if ! losetup $LOOP_DEV $TMP/tacl/blkext3 2>&1 > /dev/null; then
>  		echo ""
> -		tst_resm TCONF "[ losetup.2 ] Failed to setup the device."
> -		exit 0
> +		tst_brkm TCONF "[ losetup.2 ] Failed to setup the device."
>  	fi
>  
>  	mount | grep ext2
> @@ -180,20 +195,18 @@ then
>  	${TCbin}/acl_file_test $FILE_ACL
>  	if [ $? -ne 0 ]
>  	then
> -		EXIT_CODE=1
> -		echo "Extended acls for files (FAILED)"
> +		tst_resm TFAIL "Extended acls for files."
>  	else
> -		echo "Extended acls for files (PASSED)"
> +		tst_resm TPASS "Extended acls for files."
>  	fi
>  
>  	echo "Trying extended acls for file links"
>  	${TCbin}/acl_link_test $FILE_ACL_LINK
>  	if [ $? -ne 0 ]
>  	then
> -		EXIT_CODE=1
> -		echo "Extended acls for links (FAILED)"
> +		tst_resm TFAIL "Extended acls for links."
>  	else
> -		echo "Extended acls for links (PASSED)"
> +		tst_resm TPASS "Extended acls for links."
>  	fi
>  else
>  	do_setup
> @@ -211,20 +224,18 @@ else
>  	${TCbin}/acl_file_test $FILE_ACL
>  	if [ $? -ne 0 ]
>  	then
> -		EXIT_CODE=1
> -		echo "Extended acls for files (FAILED)"
> +		tst_resm TFAIL "Extended acls for files."
>  	else
> -		echo "Extended acls for files (PASSED)"
> +		tst_resm TPASS "Extended acls for files."
>  	fi
>  
>  	echo "Trying extended acls for file links"
>  	${TCbin}/acl_link_test $FILE_ACL_LINK
>  	if [ $? -ne 0 ]
>  	then
> -		EXIT_CODE=1
> -		echo "Extended acls for links (FAILED)"
> +		tst_resm TFAIL "Extended acls for links."
>  	else
> -		echo "Extended acls for links (PASSED)"
> +		tst_resm TPASS "Extended acls for links."
>  	fi
>  
>  	chown $TEST_USER1 $FILE_ACL
> @@ -235,4 +246,4 @@ else
>  	do_cleanup
>  fi
>  
> -exit $EXIT_CODE
> +tst_exit
> --
> 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
> 

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH v3] fs/acls: fix some permission issue in the testcase
       [not found] <1426158755-20918-1-git-send-email-liwang@redhat.com>
  2015-04-14 10:13 ` [LTP] [PATCH v3] fs/acls: fix some permission issue in the testcase Li Wang
@ 2015-04-22 14:42 ` Cyril Hrubis
  1 sibling, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2015-04-22 14:42 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp-list

Hi!
I've changed the last uses of exit 1 to tst_brkm TCONF (the if after the
mount at line 158 and 170) and pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-22 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1426158755-20918-1-git-send-email-liwang@redhat.com>
2015-04-14 10:13 ` [LTP] [PATCH v3] fs/acls: fix some permission issue in the testcase Li Wang
2015-04-22 14:42 ` Cyril Hrubis

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.