ping.py: add stricter pass/fail check

the ping test should only pass if not a single ping is lost

Change-Id: If089f77df1ffe991f26f1546558d51aac242df83
changes/43/24043/4
Andre Puschmann 2 years ago
parent 31ecf59ffd
commit 47f4f09592
  1. 9
      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)
Loading…
Cancel
Save