WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit b1d299f

Browse files
Duplicates in ping
1 parent ec52d8d commit b1d299f

File tree

5 files changed

+55
-4
lines changed

5 files changed

+55
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## moler 4.3.1
2+
* duplicates in ping
3+
14
## moler 4.3.0
25
* Command Crrl+C
36
* Enhancement of MolerTimeout exception

moler/cmd/unix/ctrl_c.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def __init__(self, connection, prompt=None, expected_prompt=None, newline_chars=
3333
:param allowed_newline_after_prompt: If True then newline chars may occur after expected (target) prompt.
3434
:param prompt_after_login: prompt after login before send export PS1. If you do not change prompt exporting PS1
3535
then leave it None.
36-
:param allowed_newline_after_prompt: If True, allows newline after prompt.
3736
"""
3837
super(CtrlC, self).__init__(connection=connection, prompt=prompt, expected_prompt=expected_prompt,
3938
newline_chars=newline_chars, runner=runner,

moler/cmd/unix/iperf2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ def has_any_result(self) -> bool:
645645
else:
646646
self._output_parsed = True # we don't exepect any specific data for this instance.
647647
return super(Iperf2, self).has_any_result()
648+
return False
648649

649650

650651
COMMAND_OUTPUT_version = """xyz@debian:~$ iperf --version

moler/cmd/unix/ping.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ def _parse_trans_recv_loss(self, line):
106106
self.current_ret['time_seconds'] = None
107107
raise ParsingDone
108108

109+
# 7 packets transmitted, 7 received, +6 duplicates, 0% packet loss, time 6142ms
109110
# 4 packets transmitted, 3 received, +1 errors, 25% packet loss, time 3008ms
110111
_re_trans_recv_loss_time_plus_errors = re.compile(
111-
r"(?P<PKTS_TRANS>\d+) packets transmitted, (?P<PKTS_RECV>\d+) received, \+?(?P<ERRORS>\d+) errors, (?P<PKT_LOSS>\S+)% packet loss, time (?P<TIME>\d+)\s*(?P<UNIT>\w+)")
112+
r"(?P<PKTS_TRANS>\d+) packets transmitted, (?P<PKTS_RECV>\d+) received, \+?(?P<ERRORS>\d+) (?P<ERR_DUP>errors|duplicates), (?P<PKT_LOSS>\S+)% packet loss, time (?P<TIME>\d+)\s*(?P<UNIT>\w+)")
112113

113114
def _parse_trans_recv_loss_time_plus_errors(self, line):
114115
"""
@@ -121,7 +122,7 @@ def _parse_trans_recv_loss_time_plus_errors(self, line):
121122
self._regex_helper.group('PKTS_TRANS'))
122123
self.current_ret['packets_received'] = self._converter_helper.to_number(
123124
self._regex_helper.group('PKTS_RECV'))
124-
self.current_ret['errors'] = self._converter_helper.to_number(self._regex_helper.group('ERRORS'))
125+
self.current_ret[self._regex_helper.group('ERR_DUP')] = self._converter_helper.to_number(self._regex_helper.group('ERRORS'))
125126
self.current_ret['packet_loss'] = self._converter_helper.to_number(self._regex_helper.group('PKT_LOSS'))
126127
self.current_ret['time'] = self._converter_helper.to_number(self._regex_helper.group('TIME'))
127128
self.current_ret['packets_time_unit'] = self._regex_helper.group('UNIT')
@@ -431,3 +432,50 @@ def _parse_min_avg_max_mdev_unit_time(self, line):
431432
'time_mdev_seconds': 0.000 * 0.001,
432433
'time_unit': 'ms',
433434
}
435+
436+
437+
COMMAND_OUTPUT_duplicates = """ping 192.168.1.2 -c 7
438+
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
439+
64 bytes from 192.168.1.2: icmp_seq=1 ttl=254 time=0.297 ms
440+
64 bytes from 192.168.1.2: icmp_seq=1 ttl=254 time=0.298 ms (DUP!)
441+
64 bytes from 192.168.1.2: icmp_seq=2 ttl=254 time=0.291 ms
442+
64 bytes from 192.168.1.2: icmp_seq=2 ttl=254 time=0.291 ms (DUP!)
443+
64 bytes from 192.168.1.2: icmp_seq=3 ttl=254 time=0.310 ms
444+
64 bytes from 192.168.1.2: icmp_seq=3 ttl=254 time=0.310 ms (DUP!)
445+
64 bytes from 192.168.1.2: icmp_seq=4 ttl=254 time=0.282 ms
446+
64 bytes from 192.168.1.2: icmp_seq=4 ttl=254 time=0.282 ms (DUP!)
447+
64 bytes from 192.168.1.2: icmp_seq=5 ttl=254 time=0.356 ms
448+
64 bytes from 192.168.1.2: icmp_seq=5 ttl=254 time=0.356 ms (DUP!)
449+
64 bytes from 192.168.1.2: icmp_seq=6 ttl=254 time=0.286 ms
450+
64 bytes from 192.168.1.2: icmp_seq=6 ttl=254 time=0.286 ms (DUP!)
451+
64 bytes from 192.168.1.2: icmp_seq=7 ttl=254 time=0.327 ms
452+
453+
--- 192.168.1.2 ping statistics ---
454+
7 packets transmitted, 7 received, +6 duplicates, 0% packet loss, time 6142ms
455+
rtt min/avg/max/mdev = 0.282/0.305/0.356/0.024 ms
456+
moler@moler:>"""
457+
458+
459+
COMMAND_KWARGS_duplicates = {
460+
'destination': '192.168.1.2',
461+
'options': '-c 7'
462+
}
463+
464+
COMMAND_RESULT_duplicates = {
465+
'packets_transmitted': 7,
466+
'packets_received': 7,
467+
'packet_loss': 0,
468+
'time': 6142,
469+
'time_seconds': 6.142,
470+
'packets_time_unit': 'ms',
471+
'duplicates': 6,
472+
'time_min': 0.282,
473+
'time_avg': 0.305,
474+
'time_max': 0.356,
475+
'time_mdev': 0.024,
476+
'time_min_seconds': 0.282 * 0.001,
477+
'time_avg_seconds': 0.305 * 0.001,
478+
'time_max_seconds': 0.356 * 0.001,
479+
'time_mdev_seconds': 0.024 * 0.001,
480+
'time_unit': 'ms',
481+
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name='moler',
15-
version='4.3.0',
15+
version='4.3.1',
1616
description='Moler is a library for working with terminals, mainly for automated tests', # Required
1717
long_description=long_description,
1818
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)