[LTP] [PATCH 1/2] tst_net.sh: Print netstress.c logs on unexpected error
Petr Vorel
pvorel@suse.cz
Tue Jan 27 14:14:25 CET 2026
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
More information about the ltp
mailing list