[Ocfs2-test-devel] [PATCH 1/1] Ocfs2-test: Forbid root user to run xattr-test.

Tristan Ye tristan.ye at oracle.com
Sun Feb 15 23:55:03 PST 2009


Since xattr-tests use remote_mount(which forbid us to run as root), we
as well prevent the user from running test at the very beginning. so it
will not try to do the needless and time-consuming  mkfs before remote_mount
when we're root.

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 programs/xattr_tests/xattr-multi-run.sh  |    4 ++++
 programs/xattr_tests/xattr-single-run.sh |    6 ++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/programs/xattr_tests/xattr-multi-run.sh b/programs/xattr_tests/xattr-multi-run.sh
index 9b91f3a..cb6984f 100755
--- a/programs/xattr_tests/xattr-multi-run.sh
+++ b/programs/xattr_tests/xattr-multi-run.sh
@@ -203,6 +203,10 @@ f_create_hostfile()
 
 f_setup()
 {
+	if [ "${UID}" = "0" ];then
+		echo "Should not run tests as root."
+		exit 1
+	fi
 
 	f_getoptions $*
 	
diff --git a/programs/xattr_tests/xattr-single-run.sh b/programs/xattr_tests/xattr-single-run.sh
index 87d31dd..0ab7df5 100755
--- a/programs/xattr_tests/xattr-single-run.sh
+++ b/programs/xattr_tests/xattr-single-run.sh
@@ -178,6 +178,12 @@ f_getoptions()
 
 f_setup()
 {
+
+	if [ "${UID}" = "0" ];then
+		echo "Should not run tests as root."
+		exit 1
+	fi
+
 	f_getoptions $*
 
 	if [ -z "${MOUNT_POINT}" ];then 
-- 
1.5.5




More information about the Ocfs2-test-devel mailing list