[LTP] [PATCH ltp] fs/acls/acl_test01: delete test user in do_setup() before create it

Yixin Zhang yixin.zhang@intel.com
Thu May 3 20:21:19 CEST 2018


If $TEST_USER1 exist on the system (e.g. test existed abnomarlly),
do_setup() will always failed and it will never go to do_cleanup().
So delete user in do_setup if it exists before create it.

Signed-off-by: Yixin Zhang <yixin.zhang@intel.com>
---
 testcases/kernel/fs/acls/acl_test01 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/testcases/kernel/fs/acls/acl_test01 b/testcases/kernel/fs/acls/acl_test01
index c91eb5686..9d8247630 100755
--- a/testcases/kernel/fs/acls/acl_test01
+++ b/testcases/kernel/fs/acls/acl_test01
@@ -111,6 +111,7 @@ do_setup()
 		setenforce 0
 	fi
 
+	userdel $TEST_USER1 > /dev/null 2>&1
 	useradd -d $TEST_USER1_HOMEDIR -m -g $TEST_USER1_GROUP $TEST_USER1 -s /bin/sh
 	if [ $? -ne 0 ]; then
 		tst_brkm TBROK "Could not add test user $TEST_USER1."
-- 
2.14.1



More information about the ltp mailing list