Skip to contentSkip to conversation

lib/test_net.sh: add waiting loop to netload()

PATCH New Alexey Kodanev 2 participants 4 messages Sep 16, 2015 – Sep 22, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/test_net.sh: add waiting loop to netload()

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

---
 testcases/lib/test_net.sh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
testcases/lib/test_net.sh +11 -0
index 9df49d2..b42337a 100644
@@ -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
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 lib/test_net.sh: add waiting loop to netload()

----- Original Message -----

Quoted 19 lines

From: "Alexey Kodanev" <[email protected]>
To: [email protected]
Cc: "vasily isaenko" <[email protected]>
Sent: Wednesday, 16 September, 2015 11:43:42 AM
Subject: [LTP] [PATCH] lib/test_net.sh: add waiting loop to netload()

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

---
 testcases/lib/test_net.sh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
testcases/lib/test_net.sh +0 -0
index 9df49d2..b42337a 100644

testcases/lib/test_net.sh tst_netload() · line 288

Quoted 7 lines
testcases/lib/test_net.sh +4 -0
@@ -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

Isn't this too generic match? Can we add "-t" to ss parameters? "ss -ln" gives me also unix sockets along with their inode numbers on output, which seems they could easily match any port number.

Regards,
Jan

Quoted 17 lines
testcases/lib/test_net.sh +7 -1
+			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

--
Mailing list info: http://lists.linux.it/listinfo/ltp

#2 lore raw

PATCH 1/1 lib/test_net.sh: add waiting loop to netload()

Hi,

Quoted 11 lines · Jan Stancek

testcases/lib/test_net.sh tst_netload() · line 288

Quoted 8 lines
testcases/lib/test_net.sh +4 -0
@@ -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

Isn't this too generic match? Can we add "-t" to ss parameters? "ss -ln" gives me also unix sockets along with their inode numbers on output, which seems they could easily match any port number.

Right, we can use -t option to match only TCP sockets... I'll add it.

Thanks,
Alexey

#3 lore raw

PATCH 1/1 lib/test_net.sh: add waiting loop to netload()

Patch applied.

Thanks,
Alexey