From 68d876601bab15760c1d87df8075e43cea68bd78 Mon Sep 17 00:00:00 2001
From: adilger <adilger>
Date: Wed, 18 Sep 2002 16:51:42 +0000
Subject: [PATCH] Fixup readme a bit to reflect reality. Add object type to
 test_getattr obdo, so it works with obdfilter. Fix up threading again, for
 "asked-for-threads-but-not-running-threads" case.

---
 lustre/tests/README   |  7 ++++---
 lustre/tests/runtests |  9 ++++-----
 lustre/utils/obd.c    | 22 ++++++++++++++--------
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/lustre/tests/README b/lustre/tests/README
index 2e50b8a979..7b57867422 100644
--- a/lustre/tests/README
+++ b/lustre/tests/README
@@ -52,12 +52,13 @@ You can create a simple echo client by running the "llecho.sh" to
 run the tests locally (over TCP loopback), or edit llecho.sh to
 specify the SERVER and CLIENT names.  You would then set up as normal:
 
-    # for a single system, or for a remote server
+    # if you are using a remote server, first run:
     server# ../utils/lconf echo.xml
 
-Launch the test script via:
+Configure the client (or if you are running a single system only):
 
-    client# sh runregression-net.sh echo.xml
+    client# ../utils/lconf echo.xml
+    client# sh runregression-net.sh
 
 3. runtests
 
diff --git a/lustre/tests/runtests b/lustre/tests/runtests
index c53596e2cf..c883809599 100755
--- a/lustre/tests/runtests
+++ b/lustre/tests/runtests
@@ -13,20 +13,19 @@ fail() {
 
 export PATH=/sbin:/usr/sbin:$SRCDIR:$PATH
 
-REFORMAT="--reformat"
 ERROR=
 SRC=/etc
 [ "$COUNT" ] || COUNT=1000
 
 [ "$LCONF" ] || LCONF=$SRCDIR/../utils/lconf
 
-OSCMT="`mount | awk '/ lustre_lite / { print $3 }'`"
+OSCMT="`mount | awk '/ lustre_lite / { print $3 }' | tail -1`"
 if [ -z "$OSCMT" ]; then
-	$LCONF $REFORMAT $@ || exit 1
+	[ -z "$*" ] && fail "usage: $0 [--reformat] <conf>.xml" 1
+	$LCONF $@ || exit 1
         trap "$LCONF --cleanup $@" 0
 	OSCMT="`mount | awk '/ lustre_lite / { print $3 }'`"
-	[ -z "$OSCMT" ] && echo "no lustre filesystem mounted" 2>&1 && exit 1
-	exit $RC
+	[ -z "$OSCMT" ] && fail "no lustre filesystem mounted" 1
 fi
 
 # let's start slowly here...
diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c
index 3de5d607a5..24b59e5f05 100644
--- a/lustre/utils/obd.c
+++ b/lustre/utils/obd.c
@@ -949,9 +949,11 @@ int jt_obd_test_getattr(int argc, char **argv)
         }
 
         if (argc >= 4) {
-                if (argv[3][0] == 't' && thread)
-                        objid = strtoull(argv[3] + 1, &end, 0) + thread - 1;
-                else
+                if (argv[3][0] == 't') {
+                        objid = strtoull(argv[3] + 1, &end, 0);
+                        if (thread)
+                                objid += thread - 1;
+                } else
                         objid = strtoull(argv[3], &end, 0);
                 if (*end) {
                         fprintf(stderr, "error: %s: invalid objid '%s'\n",
@@ -969,6 +971,7 @@ int jt_obd_test_getattr(int argc, char **argv)
 
         for (i = 1, next_count = verbose; i <= count; i++) {
                 data.ioc_obdo1.o_id = objid;
+                data.ioc_obdo1.o_mode = S_IFREG;
                 data.ioc_obdo1.o_valid = 0xffffffff;
                 rc = ioctl(fd, OBD_IOC_GETATTR, &data);
                 SHMEM_BUMP();
@@ -1022,9 +1025,10 @@ int jt_obd_test_brw(int argc, char **argv)
         }
 
         /* make each thread write to a different offset */
-        if (argv[1][0] == 't' && thread) {
-                thr_offset = thread - 1;
+        if (argv[1][0] == 't') {
                 count = strtoull(argv[1] + 1, &end, 0);
+                if (thread)
+                        thr_offset = thread - 1;
         } else
                 count = strtoull(argv[1], &end, 0);
 
@@ -1056,9 +1060,11 @@ int jt_obd_test_brw(int argc, char **argv)
                 }
         }
         if (argc >= 6) {
-                if (argv[5][0] == 't' && thread)
-                        objid = strtoull(argv[5] + 1, &end, 0) + thread - 1;
-                else
+                if (argv[5][0] == 't') {
+                        objid = strtoull(argv[5] + 1, &end, 0);
+                        if (thread)
+                                objid += thread - 1;
+                } else
                         objid = strtoull(argv[5], &end, 0);
                 if (*end) {
                         fprintf(stderr, "error: %s: bad objid '%s'\n",
-- 
GitLab