public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error
@ 2026-01-27 13:14 Petr Vorel
  2026-01-27 13:14 ` [LTP] [PATCH 2/2] tst_net.sh: Fix tst_brk() use in tst_netload_brk() Petr Vorel
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Petr Vorel @ 2026-01-27 13:14 UTC (permalink / raw)
  To: ltp

When there is an unexpected error, logs should be printed as well to
know the reason:

    tcp_fastopen_run 1 TINFO: run server 'netstress -t 0 -d ltp_ns_veth1 -R 3 \
	-B /tmp/LTP_tcp_fastopen_run.TpwSlSogBJ'
    tcp_fastopen_run 1 TINFO: run client 'netstress -l -t 0 -H 10.0.0.1 -d ltp_ns_veth2 \
	-a 2 -r 2000 -c /tmp/LTP_tcp_fastopen_run.TpwSlSogBJ/tst_netload.res' 5 times
    tcp_fastopen_run 1 TWARN: netstress failed, ret: 6
    tcp_fastopen_run 1 TPASS: netstress passed, median time 123 ms, data: 118 124 122 125

While at it, factor out logging code into new function
tst_netload_print_log().

Fixes: da16b664e7 ("lib/tst_net: calc mean in tst_netload()")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/tst_net.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index ec49f5fab9..20f669f56e 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -732,10 +732,15 @@ tst_wait_ipv6_dad()
 	done
 }
 
-tst_netload_brk()
+tst_netload_print_log()
 {
 	tst_rhost_run -c "cat $TST_TMPDIR/netstress.log"
 	cat tst_netload.log
+}
+
+tst_netload_brk()
+{
+	tst_netload_print_log
 	tst_brk_ $1 $2
 }
 
@@ -853,6 +858,7 @@ tst_netload()
 				tst_netload_brk TFAIL "expected '$expect_res' but ret: '$ret'"
 
 			tst_res_ TWARN "netstress failed, ret: $ret"
+			tst_netload_print_log
 			was_failure=1
 			continue
 		fi
-- 
2.51.0


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

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

* [LTP] [PATCH 2/2] tst_net.sh: Fix tst_brk() use in tst_netload_brk()
  2026-01-27 13:14 [LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error Petr Vorel
@ 2026-01-27 13:14 ` Petr Vorel
  2026-01-28  0:51   ` Li Wang via ltp
  2026-01-29 14:17   ` Cyril Hrubis
  2026-01-28  0:51 ` [LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error Li Wang via ltp
  2026-01-29 14:16 ` Cyril Hrubis
  2 siblings, 2 replies; 7+ messages in thread
From: Petr Vorel @ 2026-01-27 13:14 UTC (permalink / raw)
  To: ltp

Since 1878502f63 ("tst_test.sh/tst_brk(): Allow only TBROK and TCONF")
it's not possible to use tst_brk() with TFAIL. Call tst_res() followed
by tst_brk() for TFAIL/TWARN.

Also convert failure on missing file to TBROK.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Alternative would be to revert 1878502f63.

 testcases/lib/tst_net.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 20f669f56e..76f6b20e31 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -741,7 +741,12 @@ tst_netload_print_log()
 tst_netload_brk()
 {
 	tst_netload_print_log
-	tst_brk_ $1 $2
+	if [ "$1" != TBROK -a "$1" != TCONF ]; then
+		tst_res_ $1 $2
+		tst_brk_ TBROK "quit due previous failures"
+	else
+		tst_brk_ $1 $2
+	fi
 }
 
 # Run network load test, see 'netstress -h' for option description
@@ -863,8 +868,7 @@ tst_netload()
 			continue
 		fi
 
-		[ ! -f $rfile ] && \
-			tst_netload_brk TFAIL "can't read $rfile"
+		[ ! -f $rfile ] && tst_netload_brk TBROK "can't read $rfile"
 
 		results="$results $(cat $rfile)"
 		passed=$((passed + 1))
-- 
2.51.0


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

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

* Re: [LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error
  2026-01-27 13:14 [LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error Petr Vorel
  2026-01-27 13:14 ` [LTP] [PATCH 2/2] tst_net.sh: Fix tst_brk() use in tst_netload_brk() Petr Vorel
@ 2026-01-28  0:51 ` Li Wang via ltp
  2026-01-29 14:16 ` Cyril Hrubis
  2 siblings, 0 replies; 7+ messages in thread
From: Li Wang via ltp @ 2026-01-28  0:51 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

On Tue, Jan 27, 2026 at 9:15 PM Petr Vorel <pvorel@suse.cz> wrote:

> When there is an unexpected error, logs should be printed as well to
> know the reason:
>
>     tcp_fastopen_run 1 TINFO: run server 'netstress -t 0 -d ltp_ns_veth1
> -R 3 \
>         -B /tmp/LTP_tcp_fastopen_run.TpwSlSogBJ'
>     tcp_fastopen_run 1 TINFO: run client 'netstress -l -t 0 -H 10.0.0.1 -d
> ltp_ns_veth2 \
>         -a 2 -r 2000 -c
> /tmp/LTP_tcp_fastopen_run.TpwSlSogBJ/tst_netload.res' 5 times
>     tcp_fastopen_run 1 TWARN: netstress failed, ret: 6
>     tcp_fastopen_run 1 TPASS: netstress passed, median time 123 ms, data:
> 118 124 122 125
>
> While at it, factor out logging code into new function
> tst_netload_print_log().
>
> Fixes: da16b664e7 ("lib/tst_net: calc mean in tst_netload()")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
>

Reviewed-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang

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

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

* Re: [LTP] [PATCH 2/2] tst_net.sh: Fix tst_brk() use in tst_netload_brk()
  2026-01-27 13:14 ` [LTP] [PATCH 2/2] tst_net.sh: Fix tst_brk() use in tst_netload_brk() Petr Vorel
@ 2026-01-28  0:51   ` Li Wang via ltp
  2026-01-29 14:17   ` Cyril Hrubis
  1 sibling, 0 replies; 7+ messages in thread
From: Li Wang via ltp @ 2026-01-28  0:51 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

On Tue, Jan 27, 2026 at 9:14 PM Petr Vorel <pvorel@suse.cz> wrote:

> Since 1878502f63 ("tst_test.sh/tst_brk(): Allow only TBROK and TCONF")
> it's not possible to use tst_brk() with TFAIL. Call tst_res() followed
> by tst_brk() for TFAIL/TWARN.
>
> Also convert failure on missing file to TBROK.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>


Reviewed-by: Li Wang <liwang@redhat.com>


-- 
Regards,
Li Wang

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

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

* Re: [LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error
  2026-01-27 13:14 [LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error Petr Vorel
  2026-01-27 13:14 ` [LTP] [PATCH 2/2] tst_net.sh: Fix tst_brk() use in tst_netload_brk() Petr Vorel
  2026-01-28  0:51 ` [LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error Li Wang via ltp
@ 2026-01-29 14:16 ` Cyril Hrubis
  2 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2026-01-29 14:16 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH 2/2] tst_net.sh: Fix tst_brk() use in tst_netload_brk()
  2026-01-27 13:14 ` [LTP] [PATCH 2/2] tst_net.sh: Fix tst_brk() use in tst_netload_brk() Petr Vorel
  2026-01-28  0:51   ` Li Wang via ltp
@ 2026-01-29 14:17   ` Cyril Hrubis
  2026-01-29 21:47     ` Petr Vorel
  1 sibling, 1 reply; 7+ messages in thread
From: Cyril Hrubis @ 2026-01-29 14:17 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH 2/2] tst_net.sh: Fix tst_brk() use in tst_netload_brk()
  2026-01-29 14:17   ` Cyril Hrubis
@ 2026-01-29 21:47     ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2026-01-29 21:47 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi all,

Li, Cyril, thanks for your review, merged.

Kind regards,
Petr

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

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

end of thread, other threads:[~2026-01-29 21:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27 13:14 [LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error Petr Vorel
2026-01-27 13:14 ` [LTP] [PATCH 2/2] tst_net.sh: Fix tst_brk() use in tst_netload_brk() Petr Vorel
2026-01-28  0:51   ` Li Wang via ltp
2026-01-29 14:17   ` Cyril Hrubis
2026-01-29 21:47     ` Petr Vorel
2026-01-28  0:51 ` [LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error Li Wang via ltp
2026-01-29 14:16 ` Cyril Hrubis

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