From 3b970e1474177ed90c8a08fdd6beaec739a5256e Mon Sep 17 00:00:00 2001
From: grev <grev>
Date: Sat, 27 Oct 2007 23:41:41 +0000
Subject: [PATCH] b=13774 i=Adilger i=Walter test_54e fix

b=13769
i=Adilger
i=Nathan

t-f helper check_runas_id()
---
 lustre/tests/sanity.sh         |  4 ++--
 lustre/tests/sanityN.sh        |  2 ++
 lustre/tests/test-framework.sh | 12 +++++++++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index d7fecf86a9..df0ffa1c62 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -132,7 +132,7 @@ else
 	[ $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!"
 fi
 
-$RUNAS ls $DIR >/dev/null || error "uid $RUNAS_ID doesn't exist on MDS!"
+check_runas_id
 
 build_test_filter
 
@@ -2243,7 +2243,7 @@ test_54e() {
 	check_kernel_version 46 || return 0
 	f="$DIR/f54e"
 	string="aaaaaa"
-	mknod $f c 4 0
+	mknod $f c 5 0
 	echo $string > $f || error
 }
 run_test 54e "console/tty device works in lustre ======================"
diff --git a/lustre/tests/sanityN.sh b/lustre/tests/sanityN.sh
index 975a88b090..8773ebebae 100644
--- a/lustre/tests/sanityN.sh
+++ b/lustre/tests/sanityN.sh
@@ -67,6 +67,8 @@ OSTCOUNT=`cat $LPROC/lov/$LOVNAME/numobd`
 
 rm -rf $DIR1/[df][0-9]* $DIR1/lnk
 
+check_runas_id
+
 build_test_filter
 
 test_1a() {
diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh
index 88ec6f1cdd..2cd3049136 100644
--- a/lustre/tests/test-framework.sh
+++ b/lustre/tests/test-framework.sh
@@ -749,7 +749,7 @@ cleanup_and_setup_lustre() {
 
 check_and_cleanup_lustre() {
     if [ "`mount | grep $MOUNT`" ]; then
-        rm -rf $DIR/[Rdfs][1-9]*
+        rm -rf $DIR/[Rdfs][0-9]*
     fi
     if [ "$I_MOUNTED" = "yes" ]; then
         cleanupall -f || error "cleanup failed"
@@ -1129,3 +1129,13 @@ is_patchless ()
 {
     grep -q patchless $LPROC/version
 }
+
+check_runas_id() {
+    mkdir $DIR/d0_runas_test
+    chown $RUNAS_ID:$RUNAS_ID $DIR/d0_runas_test
+    $RUNAS touch $DIR/d0_runas_test/f$$ || \
+        error "unable to write to $DIR/d0_runas_test as UID $RUNAS_ID. 
+        Please set RUNAS_ID to some UID which exists on MDS and client or 
+        add user $RUNAS_ID:$RUNAS_ID on these nodes."
+    rm -rf $DIR/d0_runas_test
+}
-- 
GitLab