summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Goryavsky <julius.goryavsky@mariadb.com>2019-07-16 12:48:04 +0200
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2019-07-17 10:25:59 +0200
commitde0a6b92f683155feb8537cccefaf341b9275355 (patch)
treec6b54c774e62b9b3578e0e855e92a01b816ad8f6
parent61cc932781cae3864be8f964c3893cfc3f059ff6 (diff)
downloadmariadb-git-bb-10.4-MDEV-18565.tar.gz
MDEV-18565: Galera mtr-suite fails if galera library is not installedbb-10.4-MDEV-18565
Currently, running mtr with an incorrect (for example, new or obsolete) version of wsrep_provider (for example, with the 26 version of libgalera_smm.so) leads to the failure of tests in several suites with vague error diagnostics. As for the galera_3nodes suite, the mtr also does not effectively check all the prerequisites after merge with MDEV-18426 fixes. For example, tests that using mariabackup do not check for presence of ss and socat/nc. This is due to improper handling of relative paths in mtr scripts. In addition, some tests in different suites can be run without setting the environment variables such as MTR_GALERA_TFMT, XBSTREAM, and so on. To eliminate all these issues, this patch makes the following changes: 1. Added auxiliary wsrep_mtr_check utility (which located in the mysql-test/lib/My/SafeProcess subdirectory), which compares the versions of the wsrep API that used by the server and by the wsrep provider library, and it does this comparison safely, without accessing the API if the versions do not match. 2. All checks related to the presence of mariabackup and utilities that necessary for its operation transferred from the local directories of different mtr suites (from the suite.pm files) to the main suite.pm file. This not only reduces the amount of code and eliminates duplication of identical code fragments, but also avoids problems due to the inability of mtr to consider relative paths to include files when checking skip combinations. 3. Setting the values of auxiliary environment variables that are necessary for Galera, SST scripts and mariabackup (to work properly) is moved to the main mysql-test-run.pl script, so as not to duplicate this code in different suites, and to avoid partial corrections of the same errors for different suites (while other suites remain uncorrected). 4. Fixed duplication of the have_file_key_management.inc and have_filekeymanagement.inc files between different suites, these checks are also transferred to the top level. 5. Added garbd presence check and garbd path variable. https://jira.mariadb.org/browse/MDEV-18565
-rw-r--r--mysql-test/include/galera_resume.inc (renamed from mysql-test/suite/galera_3nodes/include/galera_resume.inc)0
-rw-r--r--mysql-test/include/have_file_key_management.inc (renamed from mysql-test/suite/mariabackup/include/have_file_key_management.inc)0
-rw-r--r--mysql-test/include/have_garbd.inc (renamed from mysql-test/suite/galera/include/have_mariabackup.inc)0
-rw-r--r--mysql-test/include/have_mariabackup.inc4
-rw-r--r--mysql-test/lib/My/SafeProcess.pm6
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt10
-rw-r--r--mysql-test/lib/My/SafeProcess/wsrep_check_version.c123
-rwxr-xr-xmysql-test/mysql-test-run.pl157
-rw-r--r--mysql-test/suite.pm15
-rw-r--r--mysql-test/suite/galera/include/have_filekeymanagement.inc3
-rw-r--r--mysql-test/suite/galera/suite.pm49
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.test2
-rw-r--r--mysql-test/suite/galera_3nodes/suite.pm51
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_garbd.test31
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test2
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test2
-rw-r--r--mysql-test/suite/mariabackup/suite.pm19
-rw-r--r--mysql-test/suite/wsrep/suite.pm22
18 files changed, 329 insertions, 167 deletions
diff --git a/mysql-test/suite/galera_3nodes/include/galera_resume.inc b/mysql-test/include/galera_resume.inc
index af8f2b956fd..af8f2b956fd 100644
--- a/mysql-test/suite/galera_3nodes/include/galera_resume.inc
+++ b/mysql-test/include/galera_resume.inc
diff --git a/mysql-test/suite/mariabackup/include/have_file_key_management.inc b/mysql-test/include/have_file_key_management.inc
index 06fbb510d6b..06fbb510d6b 100644
--- a/mysql-test/suite/mariabackup/include/have_file_key_management.inc
+++ b/mysql-test/include/have_file_key_management.inc
diff --git a/mysql-test/suite/galera/include/have_mariabackup.inc b/mysql-test/include/have_garbd.inc
index 0dd693f2c63..0dd693f2c63 100644
--- a/mysql-test/suite/galera/include/have_mariabackup.inc
+++ b/mysql-test/include/have_garbd.inc
diff --git a/mysql-test/include/have_mariabackup.inc b/mysql-test/include/have_mariabackup.inc
new file mode 100644
index 00000000000..0dd693f2c63
--- /dev/null
+++ b/mysql-test/include/have_mariabackup.inc
@@ -0,0 +1,4 @@
+#
+# suite.pm will make sure that all tests including this file
+# will be skipped as needed
+#
diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
index 19f2893ea51..87054019759 100644
--- a/mysql-test/lib/My/SafeProcess.pm
+++ b/mysql-test/lib/My/SafeProcess.pm
@@ -100,6 +100,8 @@ else
$bindir = getcwd();
}
+our $wsrep_check_version;
+
# Find the safe process binary or script
sub find_bin {
if (IS_WIN32PERL or IS_CYGWIN)
@@ -119,6 +121,10 @@ sub find_bin {
"my_safe_process");
push(@safe_process_cmd, $exe);
}
+ # Wsrep version check utility:
+ $wsrep_check_version=
+ my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
+ "wsrep_check_version", NOT_REQUIRED);
}
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
index a71f5d8ca36..4c3b62fa67e 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -14,7 +14,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
- IF (WIN32)
+IF (WIN32)
ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
TARGET_LINK_LIBRARIES(my_safe_kill dbghelp psapi)
@@ -22,6 +22,11 @@ ELSE()
ADD_EXECUTABLE(my_safe_process safe_process.cc)
ENDIF()
+IF(WITH_WSREP)
+ ADD_EXECUTABLE(wsrep_check_version wsrep_check_version.c)
+ TARGET_LINK_LIBRARIES(wsrep_check_version ${LIBDL})
+ENDIF()
+
IF(NOT INSTALL_MYSQLTESTDIR)
RETURN()
ENDIF()
@@ -32,6 +37,9 @@ SET(INSTALL_ARGS
)
INSTALL(TARGETS my_safe_process ${INSTALL_ARGS})
+IF(WITH_WSREP)
+ INSTALL(TARGETS wsrep_check_version ${INSTALL_ARGS})
+ENDIF()
IF (WIN32)
INSTALL(TARGETS my_safe_kill ${INSTALL_ARGS})
ENDIF()
diff --git a/mysql-test/lib/My/SafeProcess/wsrep_check_version.c b/mysql-test/lib/My/SafeProcess/wsrep_check_version.c
new file mode 100644
index 00000000000..616548d4f2d
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/wsrep_check_version.c
@@ -0,0 +1,123 @@
+/* Copyright (c) 2009, 2019, MariaDB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef _WIN32
+#include <windows.h>
+#define dlsym(lib, name) GetProcAddress((HMODULE)lib, name)
+#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0)
+#define dlclose(lib) FreeLibrary((HMODULE)lib)
+#elif defined(HAVE_DLFCN_H)
+#include <dlfcn.h>
+#else
+#define NO_DLL
+#endif
+
+#ifndef NO_DLL
+
+#include "../../../../wsrep-lib/wsrep-API/v26/wsrep_api.h"
+
+/**************************************************************************
+ * Library loader
+ **************************************************************************/
+
+static int wsrep_check_iface_version(const char *found, const char *iface_ver)
+{
+ if (strcmp(found, iface_ver)) {
+ return ERANGE;
+ }
+ return 0;
+}
+
+typedef int (*wsrep_loader_fun)(wsrep_t*);
+
+static wsrep_loader_fun wsrep_dlf(void *dlh, const char *sym)
+{
+ union {
+ wsrep_loader_fun dlfun;
+ void *obj;
+ } alias;
+ alias.obj = dlsym(dlh, sym);
+ return alias.dlfun;
+}
+
+static int wsrep_check_version_symbol(void *dlh)
+{
+ char** dlversion = NULL;
+ dlversion = (char**) dlsym(dlh, "wsrep_interface_version");
+ if (dlversion == NULL)
+ return EINVAL;
+ return wsrep_check_iface_version(*dlversion, WSREP_INTERFACE_VERSION);
+}
+
+static int wsrep_print_version(void *dlh)
+{
+ char** dlversion = NULL;
+ dlversion = (char**) dlsym(dlh, "wsrep_interface_version");
+ if (dlversion == NULL)
+ return EINVAL;
+ printf("found: %s, need: %s\n", *dlversion, WSREP_INTERFACE_VERSION);
+ return 0;
+}
+
+int main(int argc, char **argv)
+{
+ int rc = EINVAL;
+ void *dlh;
+ wsrep_loader_fun dlfun;
+
+ if (!(dlh = dlopen(getenv("WSREP_PROVIDER"), RTLD_NOW | RTLD_LOCAL))) {
+ goto err;
+ }
+
+ if (!(dlfun = wsrep_dlf(dlh, "wsrep_loader"))) {
+ goto err;
+ }
+
+ if (argc < 2 || strcmp(argv[1], "-p")) {
+ rc = wsrep_check_version_symbol(dlh);
+ }
+ else {
+ rc = wsrep_print_version(dlh);
+ }
+
+err:
+ if (dlh) dlclose(dlh);
+
+ if (rc == 0)
+ return 0;
+ else if (rc == ERANGE)
+ return 2;
+ else
+ return 1;
+}
+
+#else
+
+int main(void)
+{
+ return 1;
+}
+
+#endif
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index eab6a4e5841..e5b582c686b 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -138,6 +138,10 @@ my $opt_start_dirty;
my $opt_start_exit;
my $start_only;
my $file_wsrep_provider;
+my $extra_path;
+my $mariabackup_path;
+my $mariabackup_exe;
+my $garbd_exe;
our @global_suppressions;
@@ -372,6 +376,157 @@ $| = 1; # Automatically flush STDOUT
main();
+sub have_wsrep() {
+ my $wsrep_on= $mysqld_variables{'wsrep-on'};
+ return defined $wsrep_on
+}
+
+sub have_wsrep_provider() {
+ return $file_wsrep_provider ne "";
+}
+
+sub have_mariabackup() {
+ return $mariabackup_path ne "";
+}
+
+sub have_garbd() {
+ return $garbd_exe ne "";
+}
+
+sub check_wsrep_version() {
+ if ($My::SafeProcess::wsrep_check_version ne "") {
+ system($My::SafeProcess::wsrep_check_version);
+ return ($? >> 8) == 0;
+ }
+ else {
+ return 0;
+ }
+}
+
+sub wsrep_version_message() {
+ if ($My::SafeProcess::wsrep_check_version ne "") {
+ my $output= `$My::SafeProcess::wsrep_check_version -p`;
+ if (($? >> 8) == 0) {
+ $output =~ s/\s+\z//;
+ return "Wsrep provider version mismatch (".$output.")";
+ }
+ else {
+ return "Galera library does not contain a version symbol";
+ }
+ }
+ else {
+ return "Unable to find a wsrep version check utility";
+ }
+}
+
+sub which($) { return `sh -c "command -v $_[0]"` }
+
+sub check_garbd_support() {
+ if (defined $ENV{'MTR_GARBD_EXE'}) {
+ if (mtr_file_exists($ENV{'MTR_GARBD_EXE'}) ne "") {
+ $garbd_exe= $ENV{'MTR_GARBD_EXE'};
+ } else {
+ mtr_error("MTR_GARBD_EXE env set to an invalid path");
+ }
+ }
+ else {
+ my $wsrep_path= dirname($file_wsrep_provider);
+ $garbd_exe=
+ mtr_file_exists($wsrep_path."/garb/garbd",
+ $wsrep_path."/../../bin/garb/garbd");
+ if ($garbd_exe ne "") {
+ $ENV{MTR_GARBD_EXE}= $garbd_exe;
+ }
+ }
+}
+
+sub check_wsrep_support() {
+ if (have_wsrep()) {
+ mtr_report(" - binaries built with wsrep patch");
+
+ # ADD scripts to $PATH to that wsrep_sst_* can be found
+ my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$bindir/scripts", $path_client_bindir;
+ mtr_error("No SST scripts") unless $spath;
+ $ENV{PATH}="$spath:$ENV{PATH}";
+
+ # ADD mysql client library path to path so that wsrep_notify_cmd can find mysql
+ # client for loading the tables. (Don't assume each machine has mysql install)
+ my ($cpath) = grep { -f "$_/mysql"; } "$bindir/scripts", $path_client_bindir;
+ mtr_error("No scritps") unless $cpath;
+ $ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath;
+
+ # ADD my_print_defaults script path to path so that SST scripts can find it
+ my ($epath) = grep { -f "$_/my_print_defaults"; } "$bindir/extra", $path_client_bindir;
+ mtr_error("No my_print_defaults") unless $epath;
+ $ENV{PATH}="$epath:$ENV{PATH}" unless ($epath eq $spath) or
+ ($epath eq $cpath);
+
+ $extra_path= $epath;
+
+ if (which("socat")) {
+ $ENV{MTR_GALERA_TFMT}="socat";
+ } elsif (which("nc")) {
+ $ENV{MTR_GALERA_TFMT}="nc";
+ }
+
+ # Check whether WSREP_PROVIDER environment variable is set.
+ if (defined $ENV{'WSREP_PROVIDER'}) {
+ $file_wsrep_provider= "";
+ if ($ENV{'WSREP_PROVIDER'} ne "none") {
+ if (mtr_file_exists($ENV{'WSREP_PROVIDER'}) ne "") {
+ $file_wsrep_provider= $ENV{'WSREP_PROVIDER'};
+ } else {
+ mtr_error("WSREP_PROVIDER env set to an invalid path");
+ }
+ check_garbd_support();
+ }
+ # WSREP_PROVIDER is valid; set to a valid path or "none").
+ mtr_verbose("WSREP_PROVIDER env set to $ENV{'WSREP_PROVIDER'}");
+ } else {
+ # WSREP_PROVIDER env not defined. Lets try to locate the wsrep provider
+ # library.
+ $file_wsrep_provider=
+ mtr_file_exists("/usr/lib64/galera-4/libgalera_smm.so",
+ "/usr/lib64/galera/libgalera_smm.so",
+ "/usr/lib/galera-4/libgalera_smm.so",
+ "/usr/lib/galera/libgalera_smm.so");
+ if ($file_wsrep_provider ne "") {
+ # wsrep provider library found !
+ mtr_verbose("wsrep provider library found : $file_wsrep_provider");
+ $ENV{'WSREP_PROVIDER'}= $file_wsrep_provider;
+ check_garbd_support();
+ } else {
+ mtr_verbose("Could not find wsrep provider library, setting it to 'none'");
+ $ENV{'WSREP_PROVIDER'}= "none";
+ }
+ }
+ } else {
+ $file_wsrep_provider= "";
+ $extra_path= "";
+ }
+}
+
+sub check_mariabackup_support() {
+ $mariabackup_path= "";
+ $mariabackup_exe=
+ mtr_exe_maybe_exists(
+ "$bindir/extra/mariabackup$opt_vs_config/mariabackup",
+ "$path_client_bindir/mariabackup");
+ if ($mariabackup_exe ne "") {
+ my ($bpath) = grep { -f "$_/mariabackup"; } "$bindir/extra/mariabackup$opt_vs_config", $path_client_bindir;
+ $ENV{PATH}="$bpath:$ENV{PATH}" unless $bpath eq $extra_path;
+
+ $mariabackup_path= $bpath;
+
+ $ENV{XTRABACKUP}= $mariabackup_exe;
+
+ $ENV{XBSTREAM}= mtr_exe_maybe_exists(
+ "$bindir/extra/mariabackup/$opt_vs_config/mbstream",
+ "$path_client_bindir/mbstream");
+
+ $ENV{INNOBACKUPEX}= "$mariabackup_exe --innobackupex";
+ }
+}
sub main {
$ENV{MTR_PERL}=$^X;
@@ -417,6 +572,8 @@ sub main {
}
check_ssl_support();
check_debug_support();
+ check_wsrep_support();
+ check_mariabackup_support();
if (!$opt_suites) {
$opt_suites= join ',', collect_default_suites(@DEFAULT_SUITES);
diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm
index 5b3ccc711de..cf030dc8827 100644
--- a/mysql-test/suite.pm
+++ b/mysql-test/suite.pm
@@ -47,6 +47,21 @@ sub skip_combinations {
$skip{'main/plugin_loaderr.test'} = 'needs compiled-in innodb'
unless $::mysqld_variables{'innodb'} eq "ON";
+ $skip{'include/have_mariabackup.inc'} = 'Need mariabackup'
+ unless ::have_mariabackup();
+
+ $skip{'include/have_mariabackup.inc'} = 'Need ss'
+ unless ::which("ss");
+
+ $skip{'include/have_mariabackup.inc'} = 'Need socat or nc'
+ unless $ENV{MTR_GALERA_TFMT};
+
+ $skip{'include/have_garbd.inc'} = 'Need garbd'
+ unless ::have_garbd();
+
+ $skip{'include/have_file_key_management.inc'} = 'Needs file_key_management plugin'
+ unless $ENV{FILE_KEY_MANAGEMENT_SO};
+
# disable tests that use ipv6, if unsupported
sub ipv6_ok() {
use Socket;
diff --git a/mysql-test/suite/galera/include/have_filekeymanagement.inc b/mysql-test/suite/galera/include/have_filekeymanagement.inc
deleted file mode 100644
index f5507ca4548..00000000000
--- a/mysql-test/suite/galera/include/have_filekeymanagement.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-#
-# Used in galera/suite.pm to check file key management plugin
-#
diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm
index b8456189848..4bce28aceb2 100644
--- a/mysql-test/suite/galera/suite.pm
+++ b/mysql-test/suite/galera/suite.pm
@@ -6,30 +6,11 @@ use My::Find;
return "Not run for embedded server" if $::opt_embedded_server;
-return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
+return "WSREP is not compiled in" if not ::have_wsrep();
-my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
- "/usr/lib64/galera-4/libgalera_smm.so",
- "/usr/lib64/galera/libgalera_smm.so",
- "/usr/lib/galera-4/libgalera_smm.so",
- "/usr/lib/galera/libgalera_smm.so";
+return "No wsrep provider library" unless ::have_wsrep_provider();
-return "No wsrep provider library" unless -f $provider;
-
-$ENV{WSREP_PROVIDER} = $provider;
-
-my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir;
-return "No SST scripts" unless $spath;
-
-my ($cpath) = grep { -f "$_/mysql"; } "$::bindir/scripts", $::path_client_bindir;
-return "No scritps" unless $cpath;
-
-my ($epath) = grep { -f "$_/my_print_defaults"; } "$::bindir/extra", $::path_client_bindir;
-return "No my_print_defaults" unless $epath;
-
-my ($bpath) = grep { -f "$_/mariabackup"; } "$::bindir/extra/mariabackup", $::path_client_bindir;
-
-sub which($) { return `sh -c "command -v $_[0]"` }
+return ::wsrep_version_message() unless ::check_wsrep_version();
push @::global_suppressions,
(
@@ -88,28 +69,4 @@ push @::global_suppressions,
qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*),
);
-$ENV{PATH}="$epath:$ENV{PATH}";
-$ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath;
-$ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath;
-$ENV{PATH}="$bpath:$ENV{PATH}" unless $bpath eq $spath;
-
-if (which(socat)) {
- $ENV{MTR_GALERA_TFMT}='socat';
-} elsif (which(nc)) {
- $ENV{MTR_GALERA_TFMT}='nc';
-}
-
-sub skip_combinations {
- my %skip = ();
- $skip{'include/have_filekeymanagement.inc'} = 'needs file_key_management plugin'
- unless $ENV{FILE_KEY_MANAGEMENT_SO};
- $skip{'include/have_mariabackup.inc'} = 'Need mariabackup'
- unless which(mariabackup);
- $skip{'include/have_mariabackup.inc'} = 'Need ss'
- unless which(ss);
- $skip{'include/have_mariabackup.inc'} = 'Need socat or nc'
- unless $ENV{MTR_GALERA_TFMT};
- %skip;
-}
-
bless { };
diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.test
index 9d4f50f66ee..953a1635559 100644
--- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.test
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.test
@@ -1,6 +1,6 @@
--source include/big_test.inc
--source include/galera_cluster.inc
---source include/have_filekeymanagement.inc
+--source include/have_file_key_management.inc
--source include/innodb_encrypt_tables.inc
--source include/innodb_page_size_small.inc
--source include/have_mariabackup.inc
diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm
index 5ed5cbd95db..4a861f3b9fa 100644
--- a/mysql-test/suite/galera_3nodes/suite.pm
+++ b/mysql-test/suite/galera_3nodes/suite.pm
@@ -6,30 +6,11 @@ use My::Find;
return "Not run for embedded server" if $::opt_embedded_server;
-return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
+return "WSREP is not compiled in" if not ::have_wsrep();
-my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
- "/usr/lib64/galera-4/libgalera_smm.so",
- "/usr/lib64/galera/libgalera_smm.so",
- "/usr/lib/galera-4/libgalera_smm.so",
- "/usr/lib/galera/libgalera_smm.so";
+return "No wsrep provider library" unless ::have_wsrep_provider();
-return "No wsrep provider library" unless -f $provider;
-
-$ENV{WSREP_PROVIDER} = $provider;
-
-my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir;
-return "No SST scripts" unless $spath;
-
-my ($cpath) = grep { -f "$_/mysql"; } "$::bindir/scripts", $::path_client_bindir;
-return "No scritps" unless $cpath;
-
-my ($epath) = grep { -f "$_/my_print_defaults"; } "$::bindir/extra", $::path_client_bindir;
-return "No my_print_defaults" unless $epath;
-
-my ($bpath) = grep { -f "$_/mariabackup"; } "$::bindir/extra/mariabackup", $::path_client_bindir;
-
-sub which($) { return `sh -c "command -v $_[0]"` }
+return ::wsrep_version_message() unless ::check_wsrep_version();
push @::global_suppressions,
(
@@ -65,30 +46,4 @@ push @::global_suppressions,
qr(WSREP: JOIN message from member .* in non-primary configuration. Ignored.),
);
-
-$ENV{PATH}="$epath:$ENV{PATH}";
-$ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath;
-$ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath;
-$ENV{PATH}="$bpath:$ENV{PATH}" unless $bpath eq $spath;
-
-if (which(socat)) {
- $ENV{MTR_GALERA_TFMT}='socat';
-} elsif (which(nc)) {
- $ENV{MTR_GALERA_TFMT}='nc';
-}
-
-sub skip_combinations {
- my %skip = ();
- $skip{'include/have_filekeymanagement.inc'} = 'needs file_key_management plugin'
- unless $ENV{FILE_KEY_MANAGEMENT_SO};
- $skip{'suite/galera/include/have_mariabackup.inc'} = 'Need mariabackup'
- unless which(mariabackup);
- $skip{'suite/galera/include/have_mariabackup.inc'} = 'Need ss'
- unless which(ss);
- $skip{'suite/galera/include/have_mariabackup.inc'} = 'Need socat or nc'
- unless $ENV{MTR_GALERA_TFMT};
- %skip;
-}
-
bless { };
-
diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd.test b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
index fa3cba0ab16..05b1b25930f 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_garbd.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
@@ -5,6 +5,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--source include/have_garbd.inc
--source include/big_test.inc
# Save galera ports
@@ -30,8 +31,6 @@
--echo Killing node #3 to free ports for garbd ...
--connection node_3
---let $gp3 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('base_port =', @@wsrep_provider_options) + LENGTH('base_port = '))`
---let $galera_port_3 = `SELECT SUBSTR('$gp3', 1, LOCATE(';', '$gp3') - 1)`
--source include/shutdown_mysqld.inc
--connection node_1
@@ -39,33 +38,7 @@
--source include/wait_condition.inc
--echo Starting garbd ...
---perl
-use strict;
-use File::Basename;
-my $provider_dirname = dirname($ENV{WSREP_PROVIDER});
-# Array of possible garbd executable paths to be checked
-# base is $provider_dirname
-my @garbd_executable_search = (
- # WSREP_PROVIDER is set in galera repository
- ${provider_dirname}."/garb/garbd",
- # MariaDB (PR #1147)
- ${provider_dirname}."/../../bin/garb/garbd"
-);
-my $garbd_executable = '';
-foreach my $garbd (@garbd_executable_search) {
- if (-f $garbd) {
- $garbd_executable= $garbd;
- }
-}
-if ($garbd_executable eq '') {
- die("Didn't locate garbd\n");
-}
-die unless open(FILE, ">$ENV{MYSQLTEST_VARDIR}/tmp/garbd.inc");
-print FILE "--exec $garbd_executable --address \"gcomm://127.0.0.1:\$NODE_GALERAPORT_1\" --group my_wsrep_cluster --options 'base_port=\$NODE_GALERAPORT_3' > \$MYSQL_TMP_DIR/garbd.log 2>&1 &\n";
-close(FILE);
-EOF
---source $MYSQLTEST_VARDIR/tmp/garbd.inc
---remove_file $MYSQLTEST_VARDIR/tmp/garbd.inc
+--exec $MTR_GARBD_EXE --address "gcomm://127.0.0.1:$NODE_GALERAPORT_1" --group my_wsrep_cluster --options 'base_port=$NODE_GALERAPORT_3' > $MYSQL_TMP_DIR/garbd.log 2>&1 &
--sleep 5
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
index 71d17c133a5..2abb67421c8 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
@@ -1,6 +1,6 @@
--source include/galera_cluster.inc
--source include/check_ipv6.inc
---source suite/galera/include/have_mariabackup.inc
+--source include/have_mariabackup.inc
# Confirm that initial handshake happened over ipv6
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test
index 71d17c133a5..2abb67421c8 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test
@@ -1,6 +1,6 @@
--source include/galera_cluster.inc
--source include/check_ipv6.inc
---source suite/galera/include/have_mariabackup.inc
+--source include/have_mariabackup.inc
# Confirm that initial handshake happened over ipv6
diff --git a/mysql-test/suite/mariabackup/suite.pm b/mysql-test/suite/mariabackup/suite.pm
index 9242bbc051f..14e38d16158 100644
--- a/mysql-test/suite/mariabackup/suite.pm
+++ b/mysql-test/suite/mariabackup/suite.pm
@@ -7,31 +7,14 @@ use strict;
return "Not run for embedded server" if $::opt_embedded_server;
-my $mariabackup_exe=
-::mtr_exe_maybe_exists(
- "$::bindir/extra/mariabackup$::opt_vs_config/mariabackup",
- "$::path_client_bindir/mariabackup");
-
-return "No mariabackup" if !$mariabackup_exe;
-
-
-$ENV{XTRABACKUP}= $mariabackup_exe;
-
-$ENV{XBSTREAM}= ::mtr_exe_maybe_exists(
- "$::bindir/extra/mariabackup/$::opt_vs_config/mbstream",
- "$::path_client_bindir/mbstream");
-
-$ENV{INNOBACKUPEX}= "$mariabackup_exe --innobackupex";
+return "No mariabackup" unless ::have_mariabackup();
my $have_qpress = index(`qpress 2>&1`,"Compression") > 0;
-
sub skip_combinations {
my %skip;
- $skip{'include/have_file_key_management.inc'} = 'needs file_key_management plugin' unless $ENV{FILE_KEY_MANAGEMENT_SO};
$skip{'compress_qpress.test'}= 'needs qpress executable in PATH' unless $have_qpress;
%skip;
}
bless { };
-
diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm
index fbaf5aa2b22..7b3dae7c8c3 100644
--- a/mysql-test/suite/wsrep/suite.pm
+++ b/mysql-test/suite/wsrep/suite.pm
@@ -6,23 +6,11 @@ use My::Find;
return "Not run for embedded server" if $::opt_embedded_server;
-return "WSREP is not compiled in" unless defined $::mysqld_variables{'wsrep-on'};
+return "WSREP is not compiled in" unless ::have_wsrep();
-my ($provider) = grep { -f $_ } $ENV{WSREP_PROVIDER},
- "/usr/lib64/galera-4/libgalera_smm.so",
- "/usr/lib64/galera/libgalera_smm.so",
- "/usr/lib/galera-4/libgalera_smm.so",
- "/usr/lib/galera/libgalera_smm.so";
+return "No wsrep provider library" unless ::have_wsrep_provider();
-return "No wsrep provider library" unless -f $provider;
-
-$ENV{WSREP_PROVIDER} = $provider;
-
-my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir;
-return "No SST scripts" unless $spath;
-
-my ($epath) = grep { -f "$_/my_print_defaults"; } "$::bindir/extra", $::path_client_bindir;
-return "No my_print_defaults" unless $epath;
+return ::wsrep_version_message() unless ::check_wsrep_version();
push @::global_suppressions,
(
@@ -31,8 +19,4 @@ push @::global_suppressions,
qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
);
-$ENV{PATH}="$epath:$ENV{PATH}";
-$ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath;
-
bless { };
-