improve coverage

pull/89/merge
David Schweikert 8 years ago
parent 4e0b2277a3
commit 24ce982e5b

@ -10,7 +10,7 @@ fi
autoreconf -i autoreconf -i
./configure --enable-ipv4 --enable-ipv6 --prefix=/opt/fping ./configure --enable-ipv4 --enable-ipv6 --prefix=/opt/fping
make CFLAGS="-g -fprofile-arcs -ftest-coverage" make CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"
## setcap currently doesn't work anymore on travis-ci ## setcap currently doesn't work anymore on travis-ci
#sudo setcap cap_net_raw+ep src/fping #sudo setcap cap_net_raw+ep src/fping
## setcap debugging: ## setcap debugging:

@ -1,6 +1,6 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
use Test::Command tests => 12; use Test::Command tests => 18;
# -n show targets by name (-d is equivalent) # -n show targets by name (-d is equivalent)
# -O n set the type of service (tos) flag on the ICMP packets # -O n set the type of service (tos) flag on the ICMP packets
@ -11,6 +11,22 @@ use Test::Command tests => 12;
# fping -n -> test-14-internet-hosts # fping -n -> test-14-internet-hosts
# fping -d -n
{
my $cmd = Test::Command->new(cmd => "fping -d -n 127.0.0.1");
$cmd->exit_is_num(1);
$cmd->stdout_is_eq("");
$cmd->stderr_is_eq("fping: use either one of -d or -n\n");
}
# fping -n -d
{
my $cmd = Test::Command->new(cmd => "fping -n -d 127.0.0.1");
$cmd->exit_is_num(1);
$cmd->stdout_is_eq("");
$cmd->stderr_is_eq("fping: use either one of -d or -n\n");
}
# fping -o # fping -o
{ {
my $cmd = Test::Command->new(cmd => "fping -t100 -p 100 -o -c 5 8.8.8.7"); my $cmd = Test::Command->new(cmd => "fping -t100 -p 100 -o -c 5 8.8.8.7");

@ -1,6 +1,6 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
use Test::Command tests => 18; use Test::Command tests => 21;
use Test::More; use Test::More;
# -R random bytes # -R random bytes
@ -95,4 +95,12 @@ SKIP: {
$cmd->stderr_is_eq(""); $cmd->stderr_is_eq("");
} }
# fping -S
{
my $cmd = Test::Command->new(cmd => "fping -S bla");
$cmd->exit_is_num(1);
$cmd->stdout_is_eq("");
$cmd->stderr_is_eq("fping: can't parse source address: bla\n");
}
# fping -t tested in test-4-options-a-b.pl # fping -t tested in test-4-options-a-b.pl

@ -613,8 +613,8 @@ int main(int argc, char** argv)
break; break;
} }
#endif #endif
usage(1); fprintf(stderr, "%s: can't parse source address: %s\n", prog, optparse_state.optarg);
break; exit(1);
case 'I': case 'I':
#ifdef SO_BINDTODEVICE #ifdef SO_BINDTODEVICE

Loading…
Cancel
Save