public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] lib/test_net.sh: add waiting loop to netload()
@ 2015-09-16  9:43 Alexey Kodanev
  2015-09-17  7:41 ` Jan Stancek
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Kodanev @ 2015-09-16  9:43 UTC (permalink / raw)
  To: ltp

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] lib/test_net.sh: add waiting loop to netload()
  2015-09-16  9:43 [LTP] [PATCH] lib/test_net.sh: add waiting loop to netload() Alexey Kodanev
@ 2015-09-17  7:41 ` Jan Stancek
  2015-09-17  8:45   ` Alexey Kodanev
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Stancek @ 2015-09-17  7:41 UTC (permalink / raw)
  To: ltp





----- Original Message -----
> From: "Alexey Kodanev" <alexey.kodanev@oracle.com>
> To: ltp@lists.linux.it
> Cc: "vasily isaenko" <vasily.isaenko@oracle.com>
> 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.
> 
> 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

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

> +			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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] lib/test_net.sh: add waiting loop to netload()
  2015-09-17  7:41 ` Jan Stancek
@ 2015-09-17  8:45   ` Alexey Kodanev
  2015-09-22  9:11     ` Alexey Kodanev
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Kodanev @ 2015-09-17  8:45 UTC (permalink / raw)
  To: ltp

Hi,
On 09/17/2015 10:41 AM, Jan Stancek wrote:
>> @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] lib/test_net.sh: add waiting loop to netload()
  2015-09-17  8:45   ` Alexey Kodanev
@ 2015-09-22  9:11     ` Alexey Kodanev
  0 siblings, 0 replies; 4+ messages in thread
From: Alexey Kodanev @ 2015-09-22  9:11 UTC (permalink / raw)
  To: ltp

Patch applied.

Thanks,
Alexey


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-22  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16  9:43 [LTP] [PATCH] lib/test_net.sh: add waiting loop to netload() Alexey Kodanev
2015-09-17  7:41 ` Jan Stancek
2015-09-17  8:45   ` Alexey Kodanev
2015-09-22  9:11     ` Alexey Kodanev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox