@ -1,6 +1,6 @@
#!/usr/bin/perl -w
use Test::Command tests = > 18 ;
use Test::Command tests = > 33 ;
# -c n count of pings to send to each target (default 1)
# -C n same as -c, report results in verbose format
@ -22,6 +22,46 @@ $cmd->stderr_like(qr{localhost : xmt/rcv/%loss = 2/2/0%, min/avg/max = \d\.\d+/\
} ) ;
}
# fping -c n -q
{
my $ cmd = Test::Command - > new ( cmd = > "fping -q -c 2 -p 100 localhost 127.0.0.1" ) ;
$ cmd - > exit_is_num ( 0 ) ;
$ cmd - > stdout_is_eq ( "" ) ;
$ 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/m ax = \ d \ . \ d + /\d\.\d+/ \ d \ . \ d +
} ) ;
}
# fping -c n -a (-a is ignored)
{
my $ cmd = Test::Command - > new ( cmd = > "fping -a -c 2 -p 100 localhost 127.0.0.1" ) ;
$ cmd - > exit_is_num ( 0 ) ;
$ cmd - > stdout_like ( qr{ localhost : \ [0 \ ], 64 bytes, \ d \ . \ d+ ms \ ( \ d \ . \ d+ avg, 0% loss \ )
127 \ .0 \ .0 \ .1 : \ [ 0 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
localhost : \ [ 1 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
127 \ .0 \ .0 \ .1 : \ [ 1 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
} ) ;
$ 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/m ax = \ d \ . \ d + /\d\.\d+/ \ d \ . \ d +
} ) ;
}
# fping -c n -u (-u is ignored)
{
my $ cmd = Test::Command - > new ( cmd = > "fping -u -c 2 -p 100 localhost 127.0.0.1" ) ;
$ cmd - > exit_is_num ( 0 ) ;
$ cmd - > stdout_like ( qr{ localhost : \ [0 \ ], 64 bytes, \ d \ . \ d+ ms \ ( \ d \ . \ d+ avg, 0% loss \ )
127 \ .0 \ .0 \ .1 : \ [ 0 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
localhost : \ [ 1 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
127 \ .0 \ .0 \ .1 : \ [ 1 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
} ) ;
$ 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/m ax = \ d \ . \ d + /\d\.\d+/ \ d \ . \ d +
} ) ;
}
# fping -C n
{
my $ cmd = Test::Command - > new ( cmd = > "fping -4 -C 2 -p 100 localhost 127.0.0.1" ) ;
@ -46,6 +86,36 @@ $cmd->stderr_like(qr{localhost :( \d\.\d+){5}
} ) ;
}
# fping -C n -a (-a is ignored)
{
my $ cmd = Test::Command - > new ( cmd = > "fping -a -C 2 -p 100 localhost 127.0.0.1" ) ;
$ cmd - > exit_is_num ( 0 ) ;
$ cmd - > stdout_like ( qr{ localhost : \ [0 \ ], 64 bytes, \ d \ . \ d+ ms \ ( \ d \ . \ d+ avg, 0% loss \ )
127 \ .0 \ .0 \ .1 : \ [ 0 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
localhost : \ [ 1 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
127 \ .0 \ .0 \ .1 : \ [ 1 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
} ) ;
$ cmd - > stderr_like ( qr{ localhost : \ d \ . \ d+ \ d \ . \ d+
127 \ .0 \ .0 \ .1 : \ d \ . \ d + \ d \ . \ d +
} ) ;
}
# fping -C n -u (-u is ignored)
{
my $ cmd = Test::Command - > new ( cmd = > "fping -u -C 2 -p 100 localhost 127.0.0.1" ) ;
$ cmd - > exit_is_num ( 0 ) ;
$ cmd - > stdout_like ( qr{ localhost : \ [0 \ ], 64 bytes, \ d \ . \ d+ ms \ ( \ d \ . \ d+ avg, 0% loss \ )
127 \ .0 \ .0 \ .1 : \ [ 0 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
localhost : \ [ 1 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
127 \ .0 \ .0 \ .1 : \ [ 1 \ ] , 64 bytes , \ d \ . \ d + ms \ ( \ d \ . \ d + avg , 0 % loss \ )
} ) ;
$ cmd - > stderr_like ( qr{ localhost : \ d \ . \ d+ \ d \ . \ d+
127 \ .0 \ .0 \ .1 : \ d \ . \ d + \ d \ . \ d +
} ) ;
}
# fping -C n -i -q
{
my $ cmd = Test::Command - > new ( cmd = > "fping --quiet --interval=1 --vcount=20 --period=50 127.0.0.1 127.0.0.2" ) ;