From: David Schweikert Date: Fri, 2 May 2014 21:10:46 +0000 (+0200) Subject: more tests X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75101dd843336e737e7e51ad0b959c54ec2dc206;p=fping.git more tests --- diff --git a/ci/test-10-option-u-v.pl b/ci/test-10-option-u-v.pl new file mode 100755 index 0000000..f5ef83b --- /dev/null +++ b/ci/test-10-option-u-v.pl @@ -0,0 +1,24 @@ +#!/usr/bin/perl -w + +use Test::Command tests => 6; + +# -u show targets that are unreachable +# -v show version + +# fping -u +{ +my $cmd = Test::Command->new(cmd => "fping -r0 -u 8.8.0.0 127.0.0.1"); +$cmd->exit_is_num(1); +$cmd->stdout_is_eq("8.8.0.0\n"); +$cmd->stderr_is_eq(""); +} + +# fping -v +{ +my $cmd = Test::Command->new(cmd => "fping -v"); +$cmd->exit_is_num(0); +$cmd->stdout_like(qr{ping: Version 3\.\d+ +fping: comments to david\@schweikert\.ch +}); +$cmd->stderr_is_eq(""); +} diff --git a/ci/test-2-help.pl b/ci/test-2-help.pl index 8f84e4d..72459a7 100755 --- a/ci/test-2-help.pl +++ b/ci/test-2-help.pl @@ -26,6 +26,7 @@ Usage: fping [options] [targets...] -l loop sending pings forever -m ping multiple interfaces on target host -n show targets by name (-d is equivalent) + -O n set the type of service (tos) flag on the ICMP packets -p n interval between ping packets to one target (in millisec) (in looping and counting modes, default 1000) -q quiet (don't show per-target/per-ping results) @@ -36,7 +37,6 @@ Usage: fping [options] [targets...] -t n individual target initial timeout (in millisec) (default 500) -T n ignored (for compatibility with fping 2.4) -u show targets that are unreachable - -O n set the type of service (tos) flag on the ICMP packets -v show version targets list of targets to check (if no -f specified) diff --git a/ci/test-5-options-c-e.pl b/ci/test-5-options-c-e.pl index c2c0a56..ec84817 100755 --- a/ci/test-5-options-c-e.pl +++ b/ci/test-5-options-c-e.pl @@ -1,8 +1,6 @@ #!/usr/bin/perl -w use Test::Command tests => 12; -use Test::More; -use Time::HiRes qw(gettimeofday tv_interval); # -c n count of pings to send to each target (default 1) # -C n same as -c, report results in verbose format diff --git a/ci/test-6-options-f-h.pl b/ci/test-6-options-f-h.pl index 7ca7e8c..6168b5a 100755 --- a/ci/test-6-options-f-h.pl +++ b/ci/test-6-options-f-h.pl @@ -1,8 +1,6 @@ #!/usr/bin/perl -w use Test::Command tests => 15; -use Test::More; -use Time::HiRes qw(gettimeofday tv_interval); use File::Temp; # -f file read list of targets from a file ( - means stdin) (only if no -g specified) diff --git a/ci/test-7-options-i-m.pl b/ci/test-7-options-i-m.pl index 0cfe2d3..74ab9f2 100755 --- a/ci/test-7-options-i-m.pl +++ b/ci/test-7-options-i-m.pl @@ -1,9 +1,6 @@ #!/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 diff --git a/ci/test-8-options-n-q.pl b/ci/test-8-options-n-q.pl index 28e599f..2737dd3 100755 --- a/ci/test-8-options-n-q.pl +++ b/ci/test-8-options-n-q.pl @@ -1,11 +1,9 @@ #!/usr/bin/perl -w -use Test::Command tests => 9; -use Test::More; -use Time::HiRes qw(gettimeofday tv_interval); -use File::Temp; +use Test::Command tests => 12; # -n show targets by name (-d is equivalent) +# -O n set the type of service (tos) flag on the ICMP packets # -p n interval between ping packets to one target (in millisec) # (in looping and counting modes, default 1000) # -q quiet (don't show per-target/per-ping results) @@ -19,6 +17,14 @@ $cmd->stdout_is_eq("google-public-dns-a.google.com is alive\n"); $cmd->stderr_is_eq(""); } +# fping -O +{ +my $cmd = Test::Command->new(cmd => "fping -O 2 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 -q { my $cmd = Test::Command->new(cmd => "fping -q -p 100 -c 3 127.0.0.1"); diff --git a/ci/test-9-option-r-t.pl b/ci/test-9-option-r-t.pl index 3b30d1f..1d16a7f 100755 --- a/ci/test-9-option-r-t.pl +++ b/ci/test-9-option-r-t.pl @@ -1,9 +1,6 @@ #!/usr/bin/perl -w use Test::Command tests => 6; -use Test::More; -use Time::HiRes qw(gettimeofday tv_interval); -use File::Temp; # -r n number of retries (default 3) # -s print final stats diff --git a/src/fping.c b/src/fping.c index 92154f1..6237090 100644 --- a/src/fping.c +++ b/src/fping.c @@ -2693,6 +2693,7 @@ void usage(int is_error) fprintf(out, " -l loop sending pings forever\n" ); fprintf(out, " -m ping multiple interfaces on target host\n" ); fprintf(out, " -n show targets by name (-d is equivalent)\n" ); + fprintf(out, " -O n set the type of service (tos) flag on the ICMP packets\n" ); fprintf(out, " -p n interval between ping packets to one target (in millisec)\n" ); fprintf(out, " (in looping and counting modes, default %d)\n", perhost_interval / 100 ); fprintf(out, " -q quiet (don't show per-target/per-ping results)\n" ); @@ -2703,7 +2704,6 @@ void usage(int is_error) fprintf(out, " -t n individual target initial timeout (in millisec) (default %d)\n", timeout / 100 ); fprintf(out, " -T n ignored (for compatibility with fping 2.4)\n"); fprintf(out, " -u show targets that are unreachable\n" ); - fprintf(out, " -O n set the type of service (tos) flag on the ICMP packets\n" ); fprintf(out, " -v show version\n" ); fprintf(out, " targets list of targets to check (if no -f specified)\n" ); fprintf(out, "\n");