From 0c55ff83d43476a6de9da8ae7ad469996464652d Mon Sep 17 00:00:00 2001
From: grev <grev>
Date: Fri, 31 Oct 2008 18:30:04 +0000
Subject: [PATCH] b=17122 i=Nikita sanity test_100 fix

---
 lustre/tests/sanity.sh         | 15 +++++++++++----
 lustre/tests/test-framework.sh |  4 ++++
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index a03d22cd9f..4c462480e9 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -3681,10 +3681,17 @@ test_99f() {
 run_test 99f "cvs commit ======================================="
 
 test_100() {
-	netstat -tna | while read PROT SND RCV LOCAL REMOTE STAT; do
-		[ "$PROT" != "tcp" ] && continue
-		RPORT=`echo $REMOTE | cut -d: -f2`
+	remote_ost_nodsh && skip "remote OST with nodsh" && return
+	remote_mds_nodsh && skip "remote MDS with nodsh" && return
+	remote_servers || \
+		{ skip "useless for local single node setup" && return; }
+
+	netstat -tna | ( rc=1; while read PROT SND RCV LOCAL REMOTE STAT; do
+		[ "$PROT" != "$NETTYPE" ] && continue
+		RPORT=$(echo $REMOTE | cut -d: -f2)
 		[ "$RPORT" != "$ACCEPTOR_PORT" ] && continue
+
+		rc=0
 		LPORT=`echo $LOCAL | cut -d: -f2`
 		if [ $LPORT -ge 1024 ]; then
 			echo "bad: $PROT $SND $RCV $LOCAL $REMOTE $STAT"
@@ -3692,7 +3699,7 @@ test_100() {
 			error "local: $LPORT > 1024, remote: $RPORT"
 		fi
 	done
-	true
+	[ "$rc" = 0 ] || error "privileged port not found" )  
 }
 run_test 100 "check local port using privileged port ==========="
 
diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh
index 54b05ec2e6..19cc07608b 100644
--- a/lustre/tests/test-framework.sh
+++ b/lustre/tests/test-framework.sh
@@ -1825,6 +1825,10 @@ mdts_nodes () {
     echo $NODES_sort
 }
 
+remote_servers () {
+    remote_ost && remote_mds
+}
+
 osts_nodes () {
     local OSTNODES=$(facet_host ost1)
     local NODES_sort
-- 
GitLab