[LTP] [PATCH] lib/test_net.sh: add waiting loop to netload()

Alexey Kodanev alexey.kodanev@oracle.com
Wed Sep 16 11:43:42 CEST 2015


After starting background TCP server on remote host, check that
it assigned specified port.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/test_net.sh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 9df49d2..b42337a 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -282,6 +282,17 @@ tst_netload()
 		tst_resm TINFO "run tcp_fastopen with '$ip_addr', port '$port'"
 		tst_rhost_run -s -b -c "tcp_fastopen -R $max_requests -g $port"
 
+		# check that tcp_fastopen on rhost in 'Listening' state
+		local sec_waited=
+		for sec_waited in $(seq 1 60); do
+			tst_rhost_run -c "ss -ln | grep -q $port" && break
+			if [ $sec_waited -eq 60 ]; then
+				tst_resm TINFO "rhost not in LISTEN state"
+				return 1
+			fi
+			sleep 1
+		done
+
 		# run local tcp client
 		tcp_fastopen -a $clients_num -r $client_requests -l \
 			-H $ip_addr -g $port -d $rfile > /dev/null || ret=1
-- 
1.7.1



More information about the Ltp mailing list