From ccc0cdfdd77e0ea385b460dd187e4da07b1b9433 Mon Sep 17 00:00:00 2001 From: Erik Auerswald Date: Mon, 8 Jan 2024 09:12:59 +0100 Subject: [PATCH] Test that -g does not accept IPv6 --- ci/test-06-options-f-h.pl | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ci/test-06-options-f-h.pl b/ci/test-06-options-f-h.pl index 4f26b9e..b730763 100755 --- a/ci/test-06-options-f-h.pl +++ b/ci/test-06-options-f-h.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl -w -use Test::Command tests => 45; +use Test::Command tests => 51; +use Test::More; use File::Temp; # -f file read list of targets from a file ( - means stdin) (only if no -g specified) @@ -124,6 +125,28 @@ $cmd->stdout_is_eq(""); $cmd->stderr_is_eq("fping: netmask must be between 1 and 32 (is: 0)\n"); } +# fping -g (range - no IPv6 generator) +SKIP: { + if($ENV{SKIP_IPV6}) { + skip 'Skip IPv6 tests', 3; + } + my $cmd = Test::Command->new(cmd => "fping -6 -g ::1 ::1"); + $cmd->exit_is_num(1); + $cmd->stdout_is_eq(""); + $cmd->stderr_is_eq("fping: -g works only with IPv4 addresses\n"); +} + +# fping -g (CIDR - no IPv6 generator) +SKIP: { + if($ENV{SKIP_IPV6}) { + skip 'Skip IPv6 tests', 3; + } + my $cmd = Test::Command->new(cmd => "fping -6 -g ::1/128"); + $cmd->exit_is_num(1); + $cmd->stdout_is_eq(""); + $cmd->stderr_is_eq("fping: -g works only with IPv4 addresses\n"); +} + # fping -H { my $cmd = Test::Command->new(cmd => "fping -H 1 127.0.0.1");