Fix -M expecting an argument, when it shouldn't

version3
David Schweikert 8 years ago
parent 4db7212323
commit 4e717d3575

@ -4,6 +4,7 @@ Unreleased
* (bugfix) Fix option -m to return all IPs of a hostname * (bugfix) Fix option -m to return all IPs of a hostname
* (bugfix) Fix compatibility issue with AIX (#69, @blentzgh) * (bugfix) Fix compatibility issue with AIX (#69, @blentzgh)
* (bugfix) Fix -q not suppressing some ICMP error messages (#83) * (bugfix) Fix -q not suppressing some ICMP error messages (#83)
* (bugfix) Fix -M expecting an argument, when it shouldn't
2017-01-11 David Schweikert <david@schweikert.ch> 2017-01-11 David Schweikert <david@schweikert.ch>
* Version 3.15 * Version 3.15

@ -1,10 +1,11 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
use Test::Command tests => 4; use Test::Command tests => 7;
# -i n interval between sending ping packets (in millisec) (default 25) # -i n interval between sending ping packets (in millisec) (default 25)
# -l loop sending pings forever # -l loop sending pings forever
# -m ping multiple interfaces on target host # -m ping multiple interfaces on target host
# -M don't fragment
# fping -i n # fping -i n
{ {
@ -22,4 +23,12 @@ $cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% l
}); });
} }
# fping -M
{
my $cmd = Test::Command->new(cmd => "fping -M 127.0.0.1");
$cmd->exit_is_num(0);
$cmd->stdout_is_eq("127.0.0.1 is alive\n");
$cmd->stderr_is_eq("");
}
# fping -m -> test-14-internet-hosts # fping -m -> test-14-internet-hosts

@ -9,7 +9,7 @@ if(!gethostbyname("www.google.com")) {
exit 0; exit 0;
} }
plan tests => 18; plan tests => 21;
my $re_num = qr{\d+(?:\.\d+)?}; my $re_num = qr{\d+(?:\.\d+)?};
@ -70,3 +70,11 @@ $cmd->exit_is_num(0);
$cmd->stdout_is_eq("google-public-dns-a.google.com is alive\n"); $cmd->stdout_is_eq("google-public-dns-a.google.com is alive\n");
$cmd->stderr_is_eq(""); $cmd->stderr_is_eq("");
} }
# fping -M
{
my $cmd = Test::Command->new(cmd => "fping -r 0 -b 10000 -M 8.8.8.8");
$cmd->exit_is_num(1);
$cmd->stdout_is_eq("8.8.8.8 is unreachable\n");
$cmd->stderr_is_eq("8.8.8.8: error while sending ping: Message too long\n");
}

@ -385,7 +385,7 @@ int main( int argc, char **argv )
/* get command line options */ /* get command line options */
while( ( c = getopt( argc, argv, "gedhlmnNqusaAvDRz:t:H:i:p:f:r:c:b:C:Q:B:S:I:T:O:M:o" ) ) != EOF ) while( ( c = getopt( argc, argv, "ADMNRadeghlmnoqsuvzB:C:H:I:O:Q:S:T:b:c:f:i:p:r:t:" ) ) != EOF )
{ {
switch( c ) switch( c )
{ {

Loading…
Cancel
Save