Skip to content

Commit

Permalink
MDEV-9185: fix ipv6 detection test in MTR
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
  • Loading branch information
grooverdan authored and vuvova committed Oct 4, 2016
1 parent 4f919be commit 70dcb46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ END
our @opt_experimentals;
our $experimental_test_cases= [];

my $baseport;
our $baseport;
# $opt_build_thread may later be set from $opt_port_base
my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
my $opt_port_base= $ENV{'MTR_PORT_BASE'} || "auto";
Expand Down
12 changes: 9 additions & 3 deletions mysql-test/suite.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ sub skip_combinations {
sub ipv6_ok() {
use Socket;
return 0 unless socket my $sock, PF_INET6, SOCK_STREAM, getprotobyname('tcp');
# eval{}, if there's no Socket::sockaddr_in6 at all, old Perl installation
eval { connect $sock, sockaddr_in6(7, Socket::IN6ADDR_LOOPBACK) };
return $@ eq "";
my $ipv6_works = false;
# eval{}, if there's no Socket::sockaddr_in6 at all, old Perl installation <5.14
eval {
my $addr = sockaddr_in6($baseport, Socket::IN6ADDR_LOOPBACK) or return 0;
die 'bind failed' unless bind $sock, $addr;
close $sock;
$ipv6_works = true;
};
return $@ eq "" && $ipv6_works;
}
$skip{'include/check_ipv6.inc'} = 'No IPv6' unless ipv6_ok();

Expand Down

0 comments on commit 70dcb46

Please sign in to comment.