]> git.gsnw.org Git - fping.git/commitdiff
more tests
authorDavid Schweikert <david@schweikert.ch>
Thu, 1 May 2014 13:03:33 +0000 (15:03 +0200)
committerDavid Schweikert <david@schweikert.ch>
Thu, 1 May 2014 13:03:33 +0000 (15:03 +0200)
ci/test-7-options-i-m.pl [new file with mode: 0755]

diff --git a/ci/test-7-options-i-m.pl b/ci/test-7-options-i-m.pl
new file mode 100755 (executable)
index 0000000..63fcd31
--- /dev/null
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+
+use Test::Command tests => 7;
+use Test::More;
+use Time::HiRes qw(gettimeofday tv_interval);
+use File::Temp;
+
+#  -i n       interval between sending ping packets (in millisec) (default 25)
+#  -l         loop sending pings forever
+#  -m         ping multiple interfaces on target host
+
+# fping -i n
+{
+my $cmd = Test::Command->new(cmd => "fping -i 100 127.0.0.1 127.0.0.2");
+$cmd->exit_is_num(0);
+$cmd->stdout_is_eq("127.0.0.1 is alive\n127.0.0.2 is alive\n");
+$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\)
+});
+}
+
+# fping -m
+{
+my $cmd = Test::Command->new(cmd => "fping -m localhost");
+$cmd->exit_is_num(0);
+$cmd->stdout_is_eq("127.0.0.1 is alive\n");
+$cmd->stderr_is_eq("");
+}