]> git.gsnw.org Git - fping.git/commitdiff
ci: test timestamp plausibility
authorErik Auerswald <auerswal@unix-ag.uni-kl.de>
Sun, 23 Jun 2024 15:19:13 +0000 (17:19 +0200)
committerErik Auerswald <auerswal@unix-ag.uni-kl.de>
Fri, 28 Jun 2024 17:18:22 +0000 (19:18 +0200)
Some changes of fping resulted in some systems reporting
implausible timestamps, see, e.g., GH issue #203.  This
commit adds a simplistic plausability check for timestamps
in Unix time format: they need to be greater or equal to
1000000000 (2001-09-09 03:46:40+02:00).

ci/test-05-options-c-e.pl

index 9b290bafb5036965f87ec45cf5ddbbc135baf955..9884d116770ecf0249b787a435597a9e6f8af743 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-use Test::Command tests => 48;
+use Test::Command tests => 51;
 
 #  -c n       count of pings to send to each target (default 1)
 #  -C n       same as -c, report results in verbose format
@@ -138,6 +138,17 @@ $cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = \d\.\d
 });
 }
 
+# fping -D (timestamp not before 2001-09-09)
+{
+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{\[[1-9]\d{9,}\.\d+\] 127\.0\.0\.1 : \[0\], 64 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\)
+\[[1-9]\d{9,}\.\d+\] 127\.0\.0\.1 : \[1\], 64 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 = \d\.\d+/\d\.\d+/\d\.\d+
+});
+}
+
 # fping -D --timestamp-format=ctime
 {
 my $cmd = Test::Command->new(cmd => "fping -D --timestamp-format=ctime -c 2 -p 100 127.0.0.1");