summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/have_working_dns.inc11
-rwxr-xr-xmysql-test/mysql-test-run.pl9
-rw-r--r--mysql-test/r/have_working_dns.require2
-rw-r--r--mysql-test/t/mysql.test1
-rw-r--r--mysql-test/t/mysql_upgrade.test1
5 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/include/have_working_dns.inc b/mysql-test/include/have_working_dns.inc
new file mode 100644
index 00000000000..8fed5cd3df5
--- /dev/null
+++ b/mysql-test/include/have_working_dns.inc
@@ -0,0 +1,11 @@
+#
+# Check if we have a working DNS.
+# Some 'wildcard dns' return some address even for non-existing hosts. This
+# makes it hard to test connections to such host names.
+# The actual check for working DNS is done in Perl, and the result available
+# in an environment variable.
+#
+--require r/have_working_dns.require
+disable_query_log;
+eval SELECT LENGTH('$HAVE_BROKEN_DNS') = 0 AS 'have_working_dns';
+enable_query_log;
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index c73545bc568..9e2271bff09 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2003,6 +2003,15 @@ sub environment_setup {
$ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir;
$ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
+ #
+ # Some stupid^H^H^H^H^H^Hignorant network providers set up "wildcard DNS"
+ # servers that return some given web server address for any lookup of a
+ # non-existent host name. This confuses test cases that want to test the
+ # behaviour when connecting to a non-existing host, so we need to be able
+ # to disable those tests when DNS is broken.
+ #
+ $ENV{HAVE_BROKEN_DNS}= defined(gethostbyname('invalid_hostname'));
+
# ----------------------------------------------------
# Setup env for NDB
# ----------------------------------------------------
diff --git a/mysql-test/r/have_working_dns.require b/mysql-test/r/have_working_dns.require
new file mode 100644
index 00000000000..67b5a22ce19
--- /dev/null
+++ b/mysql-test/r/have_working_dns.require
@@ -0,0 +1,2 @@
+have_working_dns
+1
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index cffa6392fa3..a56229f1c4c 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -1,3 +1,4 @@
+-- source include/have_working_dns.inc
# This test should work in embedded server after we fix mysqltest
-- source include/not_embedded.inc
#
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index d1f97d7287e..5ee1f2cccba 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -1,3 +1,4 @@
+-- source include/have_working_dns.inc
# Can't run test of external client with embedded server
-- source include/not_embedded.inc