From 633ea983ed99018d4fb83077ed8ab791b226c70b Mon Sep 17 00:00:00 2001 From: David Schweikert Date: Tue, 19 Feb 2019 20:59:48 +0100 Subject: [PATCH] test robustness fixes --- ci/prepare-linux.sh | 3 +-- ci/test-01-basics.pl | 8 ++++---- ci/test-05-options-c-e.pl | 32 ++++++++++++++++---------------- ci/test-07-options-i-m.pl | 4 ++-- ci/test-08-options-n-q.pl | 6 +++--- ci/test-09-option-r-t.pl | 16 ++++++++-------- ci/test-15-netdata.pl | 2 +- 7 files changed, 35 insertions(+), 36 deletions(-) diff --git a/ci/prepare-linux.sh b/ci/prepare-linux.sh index 275a56f..2c4d727 100755 --- a/ci/prepare-linux.sh +++ b/ci/prepare-linux.sh @@ -3,6 +3,5 @@ sudo setcap cap_net_raw+ep src/fping if [[ ! $PATH =~ fping/src ]]; then - echo "# WARNING: must set PATH:" - echo PATH=/home/dws/checkouts/fping/src:\$PATH + PATH=/home/dws/checkouts/fping/src:$PATH fi diff --git a/ci/test-01-basics.pl b/ci/test-01-basics.pl index f18aa36..d3499f3 100755 --- a/ci/test-01-basics.pl +++ b/ci/test-01-basics.pl @@ -27,9 +27,9 @@ SKIP: { { my $cmd = Test::Command->new(cmd => "fping -p 100 -C3 127.0.0.1"); $cmd->exit_is_num(0); - $cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\) -127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\) -127\.0\.0\.1 : \[2\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\) + $cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) +127\.0\.0\.1 : \[1\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) +127\.0\.0\.1 : \[2\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) }); - $cmd->stderr_like(qr{127\.0\.0\.1 : 0\.\d+ 0\.\d+ 0\.\d+\n}); + $cmd->stderr_like(qr{127\.0\.0\.1 : \d\.\d+ \d\.\d+ \d\.\d+\n}); } diff --git a/ci/test-05-options-c-e.pl b/ci/test-05-options-c-e.pl index b9f9500..8bc03d0 100755 --- a/ci/test-05-options-c-e.pl +++ b/ci/test-05-options-c-e.pl @@ -11,14 +11,14 @@ use Test::Command tests => 12; { my $cmd = Test::Command->new(cmd => "fping -4 -c 2 -p 100 localhost 127.0.0.1"); $cmd->exit_is_num(0); -$cmd->stdout_like(qr{localhost : \[0\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\) -127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\) -localhost : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\) -127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\) +$cmd->stdout_like(qr{localhost : \[0\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) +127\.0\.0\.1 : \[0\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) +localhost : \[1\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) +127\.0\.0\.1 : \[1\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) }); -$cmd->stderr_like(qr{localhost : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+ -127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+ +$cmd->stderr_like(qr{localhost : xmt/rcv/%loss = 2/2/0%, min/avg/max = \d\.\d+/\d\.\d+/\d\.\d+ +127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = \d\.\d+/\d\.\d+/\d\.\d+ }); } @@ -26,14 +26,14 @@ $cmd->stderr_like(qr{localhost : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+/0\ { my $cmd = Test::Command->new(cmd => "fping -4 -C 2 -p 100 localhost 127.0.0.1"); $cmd->exit_is_num(0); -$cmd->stdout_like(qr{localhost : \[0\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\) -127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\) -localhost : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\) -127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\) +$cmd->stdout_like(qr{localhost : \[0\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) +127\.0\.0\.1 : \[0\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) +localhost : \[1\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) +127\.0\.0\.1 : \[1\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) }); -$cmd->stderr_like(qr{localhost : 0\.\d+ 0\.\d+ -127\.0\.0\.1 : 0\.\d+ 0\.\d+ +$cmd->stderr_like(qr{localhost : \d\.\d+ \d\.\d+ +127\.0\.0\.1 : \d\.\d+ \d\.\d+ }); } @@ -41,11 +41,11 @@ $cmd->stderr_like(qr{localhost : 0\.\d+ 0\.\d+ { my $cmd = Test::Command->new(cmd => "fping -D -c 2 -p 100 127.0.0.1"); $cmd->exit_is_num(0); -$cmd->stdout_like(qr{\[\d{10}\.\d+\] 127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\) -\[\d{10}\.\d+\] 127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\) +$cmd->stdout_like(qr{\[\d{10}\.\d+\] 127\.0\.0\.1 : \[0\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) +\[\d{10}\.\d+\] 127\.0\.0\.1 : \[1\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) }); -$cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+ +$cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = \d\.\d+/\d\.\d+/\d\.\d+ }); } @@ -53,7 +53,7 @@ $cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0\.\d+ { my $cmd = Test::Command->new(cmd => "fping -e 127.0.0.1"); $cmd->exit_is_num(0); -$cmd->stdout_like(qr{127\.0\.0\.1 is alive \(0\.\d+ ms\) +$cmd->stdout_like(qr{127\.0\.0\.1 is alive \(\d\.\d+ ms\) }); $cmd->stderr_is_eq(""); diff --git a/ci/test-07-options-i-m.pl b/ci/test-07-options-i-m.pl index 06e2ece..a2517ad 100755 --- a/ci/test-07-options-i-m.pl +++ b/ci/test-07-options-i-m.pl @@ -19,8 +19,8 @@ $cmd->stderr_is_eq(""); # fping -l { my $cmd = Test::Command->new(cmd => '(sleep 2; pkill fping)& fping -p 900 -l 127.0.0.1'); -$cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% loss\) -127\.0\.0\.1 : \[1\], 84 bytes, 0\.\d+ ms \(0\.\d+ avg, 0% loss\) +$cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) +127\.0\.0\.1 : \[1\], 84 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) }); } diff --git a/ci/test-08-options-n-q.pl b/ci/test-08-options-n-q.pl index d14173f..07d5442 100755 --- a/ci/test-08-options-n-q.pl +++ b/ci/test-08-options-n-q.pl @@ -48,7 +48,7 @@ $cmd->stderr_is_eq(""); my $cmd = Test::Command->new(cmd => "fping -q -p 100 -c 3 127.0.0.1"); $cmd->exit_is_num(0); $cmd->stdout_is_eq(""); -$cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+ +$cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 3/3/0%, min/avg/max = \d\.\d+/\d\.\d+/\d\.\d+ }); } @@ -58,8 +58,8 @@ my $cmd = Test::Command->new(cmd => "fping -Q 1 -p 400 -c 4 127.0.0.1"); $cmd->exit_is_num(0); $cmd->stdout_is_eq(""); $cmd->stderr_like(qr{\[\d+:\d+:\d+\] -127\.0\.0\.1 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+ -127\.0\.0\.1 : xmt/rcv/%loss = 4/4/0%, min/avg/max = 0\.\d+/0\.\d+/0\.\d+ +127\.0\.0\.1 : xmt/rcv/%loss = 3/3/0%, min/avg/max = \d\.\d+/\d\.\d+/\d\.\d+ +127\.0\.0\.1 : xmt/rcv/%loss = 4/4/0%, min/avg/max = \d\.\d+/\d\.\d+/\d\.\d+ }); } diff --git a/ci/test-09-option-r-t.pl b/ci/test-09-option-r-t.pl index bd118a3..997d019 100755 --- a/ci/test-09-option-r-t.pl +++ b/ci/test-09-option-r-t.pl @@ -46,10 +46,10 @@ $cmd->stderr_like(qr{\s* \s*1 ICMP Echo Replies received \s*0 other ICMP received -\s*0.\d+ ms \(min round trip time\) -\s*0.\d+ ms \(avg round trip time\) -\s*0.\d+ ms \(max round trip time\) -\s*0.\d+ sec \(elapsed real time\) +\s*\d\.\d+ ms \(min round trip time\) +\s*\d\.\d+ ms \(avg round trip time\) +\s*\d\.\d+ ms \(max round trip time\) +\s*\d\.\d+ sec \(elapsed real time\) }); } @@ -69,10 +69,10 @@ $cmd->stderr_like(qr{\s* \s*0 ICMP Echo Replies received \s*0 other ICMP received -\s*0.\d+ ms \(min round trip time\) -\s*0.\d+ ms \(avg round trip time\) -\s*0.\d+ ms \(max round trip time\) -\s*0.\d+ sec \(elapsed real time\) +\s*\d\.\d+ ms \(min round trip time\) +\s*\d\.\d+ ms \(avg round trip time\) +\s*\d\.\d+ ms \(max round trip time\) +\s*\d\.\d+ sec \(elapsed real time\) }); } diff --git a/ci/test-15-netdata.pl b/ci/test-15-netdata.pl index 7406347..8e22eb3 100755 --- a/ci/test-15-netdata.pl +++ b/ci/test-15-netdata.pl @@ -31,5 +31,5 @@ SET avg = \d{1,2} SET max = \d{1,2} END} ); -$cmd->stderr_like(qr{127.0.0.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0.\d+/0.\d+/0.\d+}); +$cmd->stderr_like(qr{127.0.0.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = \d\.\d+/\d\.\d+/\d\.\d+}); }