summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <daniel.black@au.ibm.com>2016-08-25 10:21:06 +1000
committerSergei Golubchik <serg@mariadb.org>2016-10-04 16:09:46 +0200
commit70dcb46e98e682b6d0c7c3522ddc0ebf0abb70ec (patch)
treecffb9c2cdf17b9756119892de4e63bdd3b47d0a1
parent4f919beedabb1ab46e0836b6b0dea3331228cf34 (diff)
downloadmariadb-git-70dcb46e98e682b6d0c7c3522ddc0ebf0abb70ec.tar.gz
MDEV-9185: fix ipv6 detection test in MTR
Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
-rwxr-xr-xmysql-test/mysql-test-run.pl2
-rw-r--r--mysql-test/suite.pm12
2 files changed, 10 insertions, 4 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 41b6993a604..81291789a20 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -277,7 +277,7 @@ my $current_config_name; # The currently running config file template
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";
diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm
index ea07af7376c..6991ba5f035 100644
--- a/mysql-test/suite.pm
+++ b/mysql-test/suite.pm
@@ -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();