From 47f4f09592f6f14d482523228fa64049f396f998 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Sun, 21 Mar 2021 12:13:36 +0100 Subject: [PATCH] ping.py: add stricter pass/fail check the ping test should only pass if not a single ping is lost Change-Id: If089f77df1ffe991f26f1546558d51aac242df83 --- sysmocom/suites/4g/ping.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sysmocom/suites/4g/ping.py b/sysmocom/suites/4g/ping.py index 02973179..a78b8d61 100755 --- a/sysmocom/suites/4g/ping.py +++ b/sysmocom/suites/4g/ping.py @@ -20,6 +20,13 @@ wait(ue.is_registered) print('UE is attached') proc = ue.run_netns_wait('ping', ('ping', '-c', '10', epc.tun_addr())) + +# Check zero lost pings +num_sent = int([x for x in proc.get_stdout().split('\n') if x.find('packets transmitted') != -1][0].split(' ')[0]) +num_received = int([x for x in proc.get_stdout().split('\n') if x.find('packets transmitted, ') != -1][0].split('packets transmitted, ')[1].split(' received')[0]) +if num_received != num_sent: + raise Exception("{}\n\nError: Detected {} lost pings".format(proc.get_stdout(), num_sent - num_received)) + output = proc.get_stdout() print(output) -test.set_report_stdout(output) +test.set_report_stdout(output) \ No newline at end of file