summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-04-21 18:07:11 +0200
committerAnel Husakovic <anel@mariadb.org>2020-06-17 04:01:47 +0200
commit7dd42300154348fc921b9322d2783f379960be10 (patch)
treebbefffd427adc666518cebbf75df32d464790b83
parentfb0d18e4128d82ac92c6024cb9d5e4e3c9a6da98 (diff)
downloadmariadb-git-bb-10.2-anel-wsrep.tar.gz
MDEV-18565 Galera mtr-suite fails if galera library is not installedbb-10.2-anel-wsrep
revert/simplify f5390eea9a9 remove galera-specific checks from mtr and the main suite
-rw-r--r--mysql-test/include/have_garbd.inc4
-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.txt2
-rw-r--r--mysql-test/lib/My/SafeProcess/wsrep_check_version.c129
-rwxr-xr-xmysql-test/mysql-test-run.pl192
-rw-r--r--mysql-test/suite.pm21
-rw-r--r--mysql-test/suite/galera/include/galera_have_debug_sync.inc2
-rw-r--r--mysql-test/suite/galera/include/have_mariabackup.inc7
-rw-r--r--mysql-test/suite/galera/suite.pm19
-rw-r--r--mysql-test/suite/galera/t/galera_ist_mariabackup.cnf3
-rw-r--r--mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf3
-rw-r--r--mysql-test/suite/galera_3nodes/include/galera_resume.inc (renamed from mysql-test/include/galera_resume.inc)0
-rw-r--r--mysql-test/suite/galera_3nodes/include/have_garbd.inc3
-rw-r--r--mysql-test/suite/galera_3nodes/suite.pm13
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test2
-rw-r--r--mysql-test/suite/galera_sr/suite.pm67
-rw-r--r--mysql-test/suite/mariabackup/suite.pm3
-rw-r--r--mysql-test/suite/wsrep/common.pm117
-rw-r--r--mysql-test/suite/wsrep/suite.pm13
-rw-r--r--plugin/wsrep_info/mysql-test/wsrep_info/suite.pm12
21 files changed, 274 insertions, 348 deletions
diff --git a/mysql-test/include/have_garbd.inc b/mysql-test/include/have_garbd.inc
deleted file mode 100644
index 0dd693f2c63..00000000000
--- a/mysql-test/include/have_garbd.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# suite.pm will make sure that all tests including this file
-# will be skipped as needed
-#
diff --git a/mysql-test/include/have_mariabackup.inc b/mysql-test/include/have_mariabackup.inc
deleted file mode 100644
index 0dd693f2c63..00000000000
--- a/mysql-test/include/have_mariabackup.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# 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 87054019759..19f2893ea51 100644
--- a/mysql-test/lib/My/SafeProcess.pm
+++ b/mysql-test/lib/My/SafeProcess.pm
@@ -100,8 +100,6 @@ else
$bindir = getcwd();
}
-our $wsrep_check_version;
-
# Find the safe process binary or script
sub find_bin {
if (IS_WIN32PERL or IS_CYGWIN)
@@ -121,10 +119,6 @@ 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 4c3b62fa67e..44c0e6eb8cb 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -14,6 +14,8 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
IF (WIN32)
ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
diff --git a/mysql-test/lib/My/SafeProcess/wsrep_check_version.c b/mysql-test/lib/My/SafeProcess/wsrep_check_version.c
index cec760738be..c3da8a3aeb2 100644
--- a/mysql-test/lib/My/SafeProcess/wsrep_check_version.c
+++ b/mysql-test/lib/My/SafeProcess/wsrep_check_version.c
@@ -14,110 +14,39 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
-#include <stdlib.h>
-#include <stdio.h>
+#include <my_global.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/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)
-{
+ int rc= 1;
+ void *dlh;
+ const char *provider= getenv("WSREP_PROVIDER");
+ char** dlversion= NULL;
+
+ if (!provider || !*provider)
+ {
+ printf("WSREP_PROVIDER is not set\n");
+ return 1;
+ }
+ if (!(dlh= dlopen(provider, RTLD_NOW | RTLD_LOCAL)))
+ {
+ printf("Can't open WSREP_PROVIDER (%s) library, error: %s\n",
+ provider, dlerror());
return 1;
+ }
+
+ dlversion= (char**) dlsym(dlh, "wsrep_interface_version");
+ if (dlversion && *dlversion)
+ {
+ rc= strcmp(*dlversion, WSREP_INTERFACE_VERSION) ? 2 : 0;
+ if (rc)
+ printf("Wrong wsrep provider library version, found: %s, need: %s\n", *dlversion, WSREP_INTERFACE_VERSION);
+ }
+ else
+ printf("Galera library does not contain a version symbol");
+
+ dlclose(dlh);
+ return rc;
}
-
-#endif
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 2d4f3df3f5d..0cff2da4aa8 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -139,10 +139,6 @@ 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,170 +368,6 @@ $| = 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() {
- $garbd_exe= "";
- 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;
- my $separator= (IS_WINDOWS) ? ';' : ':';
- $ENV{PATH}="$spath$separator$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$separator$ENV{PATH}" unless $cpath eq $spath;
-
- # ADD my_print_defaults script path to path so that SST scripts can find it
- my $my_print_defaults_exe=
- mtr_exe_maybe_exists(
- "$bindir/extra/my_print_defaults",
- "$path_client_bindir/my_print_defaults");
- my $epath= "";
- if ($my_print_defaults_exe ne "") {
- $epath= dirname($my_print_defaults_exe);
- }
- mtr_error("No my_print_defaults") unless $epath;
- $ENV{PATH}="$epath$separator$ENV{PATH}" unless ($epath eq $spath) or
- ($epath eq $cpath);
-
- $extra_path= $epath;
-
- if (!IS_WINDOWS) {
- 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-3/libgalera_smm.so",
- "/usr/lib64/galera/libgalera_smm.so",
- "/usr/lib/galera-3/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= dirname($mariabackup_exe);
- my $separator= (IS_WINDOWS) ? ';' : ':';
- $ENV{PATH}="$bpath$separator$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;
@@ -580,8 +412,7 @@ sub main {
}
check_ssl_support();
check_debug_support();
- check_wsrep_support();
- check_mariabackup_support();
+ environment_setup();
if (!$opt_suites) {
$opt_suites= join ',', collect_default_suites(@DEFAULT_SUITES);
@@ -2582,10 +2413,23 @@ sub environment_setup {
my $exe_innochecksum=
mtr_exe_maybe_exists("$bindir/extra$opt_vs_config/innochecksum",
"$path_client_bindir/innochecksum");
- if ($exe_innochecksum)
- {
- $ENV{'INNOCHECKSUM'}= native_path($exe_innochecksum);
- }
+ $ENV{'INNOCHECKSUM'}= native_path($exe_innochecksum) if $exe_innochecksum;
+
+ # ----------------------------------------------------
+ # mariabackup
+ # ----------------------------------------------------
+ my $exe_mariabackup= mtr_exe_maybe_exists(
+ "$bindir/extra/mariabackup$opt_vs_config/mariabackup",
+ "$path_client_bindir/mariabackup");
+
+ $ENV{XTRABACKUP}= native_path($exe_mariabackup) if $exe_mariabackup;
+
+ my $exe_xbstream= mtr_exe_maybe_exists(
+ "$bindir/extra/mariabackup/$opt_vs_config/mbstream",
+ "$path_client_bindir/mbstream");
+ $ENV{XBSTREAM}= native_path($exe_xbstream) if $exe_xbstream;
+
+ $ENV{INNOBACKUPEX}= "$exe_mariabackup --innobackupex";
# Create an environment variable to make it possible
# to detect that valgrind is being used from test cases
diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm
index 5fc6f00b460..fe68295340c 100644
--- a/mysql-test/suite.pm
+++ b/mysql-test/suite.pm
@@ -59,27 +59,6 @@ sub skip_combinations {
$skip{'t/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 socket statistics utility'
- unless IS_WINDOWS || ::which("ss");
-
- $skip{'include/have_mariabackup.inc'} = 'Need socat or nc'
- unless IS_WINDOWS || $ENV{MTR_GALERA_TFMT};
-
- $skip{'include/have_xtrabackup.inc'} = 'Need innobackupex'
- unless IS_WINDOWS || ::which("innobackupex");
-
- $skip{'include/have_xtrabackup.inc'} = 'Need socat or nc'
- unless IS_WINDOWS || $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/galera_have_debug_sync.inc b/mysql-test/suite/galera/include/galera_have_debug_sync.inc
index 7c0156052d8..21e7b3c88c3 100644
--- a/mysql-test/suite/galera/include/galera_have_debug_sync.inc
+++ b/mysql-test/suite/galera/include/galera_have_debug_sync.inc
@@ -3,7 +3,7 @@
--let $galera_have_debug_sync = `SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'`
--if (!$galera_have_debug_sync) {
- --skip "Test requires Galera debug library with debug_sync functionality"
+ --skip Test requires Galera debug library with debug_sync functionality
}
--enable_query_log
diff --git a/mysql-test/suite/galera/include/have_mariabackup.inc b/mysql-test/suite/galera/include/have_mariabackup.inc
new file mode 100644
index 00000000000..6c4ad240172
--- /dev/null
+++ b/mysql-test/suite/galera/include/have_mariabackup.inc
@@ -0,0 +1,7 @@
+if (!$XTRABACKUP) {
+ skip Needs mariabackup;
+}
+
+if (!$MTR_GALERA_TFMT) {
+ skip Needs socat or nc;
+}
diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm
index cc35f65423c..4b498225227 100644
--- a/mysql-test/suite/galera/suite.pm
+++ b/mysql-test/suite/galera/suite.pm
@@ -1,16 +1,11 @@
package My::Suite::Galera;
-use File::Basename;
-use My::Find;
-@ISA = qw(My::Suite);
-
-return "Not run for embedded server" if $::opt_embedded_server;
-
-return "WSREP is not compiled in" if not ::have_wsrep();
+use lib 'suite';
+use wsrep::common;
-return "No wsrep provider library" unless ::have_wsrep_provider();
+@ISA = qw(My::Suite);
-return ::wsrep_version_message() unless ::check_wsrep_version();
+return wsrep_not_ok() if wsrep_not_ok();
push @::global_suppressions,
(
@@ -68,4 +63,10 @@ push @::global_suppressions,
qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|,
);
+sub skip_combinations {
+ my %skip = ();
+ $skip{'include/have_mariabackup.inc'} = 'Need ss' unless `ss -V`;
+ %skip;
+}
+
bless { };
diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf
index 75dff78149d..2392071ccfe 100644
--- a/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf
+++ b/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf
@@ -10,3 +10,6 @@ wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
+[sst]
+transferfmt=@ENV.MTR_GALERA_TFMT
+streamfmt=xbstream
diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf
index 1542376b2b8..e98f37654cc 100644
--- a/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf
+++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf
@@ -12,3 +12,6 @@ wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true'
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true'
+[sst]
+transferfmt=@ENV.MTR_GALERA_TFMT
+streamfmt=xbstream
diff --git a/mysql-test/include/galera_resume.inc b/mysql-test/suite/galera_3nodes/include/galera_resume.inc
index af8f2b956fd..af8f2b956fd 100644
--- a/mysql-test/include/galera_resume.inc
+++ b/mysql-test/suite/galera_3nodes/include/galera_resume.inc
diff --git a/mysql-test/suite/galera_3nodes/include/have_garbd.inc b/mysql-test/suite/galera_3nodes/include/have_garbd.inc
new file mode 100644
index 00000000000..560372c22e9
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/include/have_garbd.inc
@@ -0,0 +1,3 @@
+if (!$MTR_GARBD_EXE) {
+ skip Needs garbd;
+}
diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm
index 4a861f3b9fa..b808db6a50a 100644
--- a/mysql-test/suite/galera_3nodes/suite.pm
+++ b/mysql-test/suite/galera_3nodes/suite.pm
@@ -1,16 +1,11 @@
package My::Suite::GALERA_3NODES;
-use File::Basename;
-use My::Find;
-@ISA = qw(My::Suite);
-
-return "Not run for embedded server" if $::opt_embedded_server;
+use lib 'suite';
+use wsrep::common;
-return "WSREP is not compiled in" if not ::have_wsrep();
-
-return "No wsrep provider library" unless ::have_wsrep_provider();
+@ISA = qw(My::Suite);
-return ::wsrep_version_message() unless ::check_wsrep_version();
+return wsrep_not_ok() if wsrep_not_ok();
push @::global_suppressions,
(
diff --git a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test
index 8dfb4660f3e..cd5c020ae38 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test
@@ -4,7 +4,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
---source include/have_mariabackup.inc
+--source suite/galera/include/have_mariabackup.inc
--let $galera_connection_name = node_3
--let $galera_server_number = 3
diff --git a/mysql-test/suite/galera_sr/suite.pm b/mysql-test/suite/galera_sr/suite.pm
new file mode 100644
index 00000000000..cc13421d66d
--- /dev/null
+++ b/mysql-test/suite/galera_sr/suite.pm
@@ -0,0 +1,67 @@
+package My::Suite::Galera_sr;
+
+use lib 'suite';
+use wsrep::common;
+
+@ISA = qw(My::Suite);
+
+return wsrep_not_ok() if wsrep_not_ok();
+
+push @::global_suppressions,
+ (
+ qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1),
+ qr(WSREP: Could not open saved state file for reading: .*),
+ qr(WSREP: Could not open state file for reading: .*),
+ qr(WSREP: Gap in state sequence. Need state transfer.),
+ qr(WSREP: Failed to prepare for incremental state transfer:),
+ qr(WSREP:.*down context.*),
+ qr(WSREP: Failed to send state UUID:),
+ qr(WSREP: last inactive check more than .* skipping check),
+ qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.),
+ qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
+ qr(WSREP: Quorum: No node with complete state),
+ qr(WSREP: Initial position was provided by configuration or SST, avoiding override),
+ qr|WSREP: discarding established \(time wait\) .*|,
+ qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.),
+ qr(WSREP: evs::proto.*),
+ qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|,
+ qr(WSREP: no nodes coming from prim view, prim not possible),
+ qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable),
+ qr(WSREP: user message in state LEAVING),
+ qr(WSREP: .* sending install message failed: Transport endpoint is not connected),
+ qr(WSREP: .* sending install message failed: Resource temporarily unavailable),
+ qr(WSREP: Maximum writeset size exceeded by .*),
+ qr(WSREP: transaction size exceeded.*),
+ qr(WSREP: RBR event .*),
+ qr(WSREP: Ignoring error for TO isolated action: .*),
+ qr(WSREP: transaction size limit .*),
+ qr(WSREP: rbr write fail, .*),
+ qr(WSREP: .*Backend not supported: foo.*),
+ qr(WSREP: .*Failed to initialize backend using .*),
+ qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*),
+ qr(WSREP: gcs connect failed: Socket type not supported),
+ qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*),
+ qr(WSREP: .*Failed to open backend connection: -110 .*),
+ qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*),
+ qr(WSREP: gcs connect failed: Connection timed out),
+ qr|WSREP: wsrep::connect\(.*\) failed: 7|,
+ qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.),
+ qr(WSREP: Could not find peer:),
+ qr(WSREP: TO isolation failed for: .*),
+ qr|WSREP: gcs_caused\(\) returned .*|,
+ qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|,
+ qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|,
+ qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|,
+ qr(WSREP: Action message in non-primary configuration from member [0-9]*),
+ qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*),
+ qr(WSREP: discarding established .*),
+ qr|WSREP: .*core_handle_uuid_msg.*|,
+ qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on),
+ qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|,
+ qr|Query apply failed:*|,
+ qr(WSREP: Ignoring error*),
+ qr(WSREP: Failed to remove page file .*),
+ qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*),
+ );
+
+bless { };
diff --git a/mysql-test/suite/mariabackup/suite.pm b/mysql-test/suite/mariabackup/suite.pm
index 14e38d16158..f0db4482156 100644
--- a/mysql-test/suite/mariabackup/suite.pm
+++ b/mysql-test/suite/mariabackup/suite.pm
@@ -7,12 +7,13 @@ use strict;
return "Not run for embedded server" if $::opt_embedded_server;
-return "No mariabackup" unless ::have_mariabackup();
+return "No mariabackup" unless $ENV{XTRABACKUP};
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;
}
diff --git a/mysql-test/suite/wsrep/common.pm b/mysql-test/suite/wsrep/common.pm
new file mode 100644
index 00000000000..8ac3b3ea94c
--- /dev/null
+++ b/mysql-test/suite/wsrep/common.pm
@@ -0,0 +1,117 @@
+package wsrep::common;
+
+use base qw(Exporter);
+our @EXPORT= qw(wsrep_not_ok);
+
+use File::Basename;
+use Memoize;
+memoize 'wrong_wsrep_version';
+memoize 'check_garbd_support';
+memoize 'check_wsrep_support';
+memoize 'wsrep_not_ok';
+
+use mtr_report;
+
+my $extra_path;
+my $mariabackup_path;
+my $mariabackup_exe;
+my $garbd_exe;
+my $file_wsrep_provider;
+
+sub wrong_wsrep_version() {
+ my $check_version= dirname($My::SafeProcess::safe_process_cmd[0]) . '/wsrep_check_version';
+ my $checked = `$check_version -p`;
+ chomp($checked);
+ return $? ? $checked : undef;
+}
+
+sub which($) { return `sh -c "command -v $_[0]"` }
+
+sub check_garbd_support() {
+ my $wsrep_path= dirname($file_wsrep_provider);
+ $garbd_exe= ::mtr_file_exists($wsrep_path."/garb/garbd",
+ $wsrep_path."/../../bin/garb/garbd",
+ '/usr/bin/garbd');
+ $ENV{MTR_GARBD_EXE}= $garbd_exe if $garbd_exe;
+}
+
+sub check_wsrep_support() {
+ 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 $my_print_defaults_exe=
+ ::mtr_exe_maybe_exists(
+ "$::bindir/extra/my_print_defaults",
+ "$::path_client_bindir/my_print_defaults");
+ my $epath= "";
+ if ($my_print_defaults_exe ne "") {
+ $epath= dirname($my_print_defaults_exe);
+ }
+ 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";
+ }
+
+ $ENV{PATH}=dirname($ENV{XTRABACKUP}).":$ENV{PATH}" if $ENV{XTRABACKUP};
+
+ # 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";
+ }
+ }
+}
+
+sub wsrep_not_ok() {
+ return "Not run for embedded server" if $::opt_embedded_server;
+ return "WSREP is not compiled in" if not $::mysqld_variables{'wsrep-on'};
+ check_wsrep_support();
+ return "No wsrep provider library" unless $file_wsrep_provider;
+ return wrong_wsrep_version() if wrong_wsrep_version();
+ undef;
+}
+
+1;
diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm
index 7b3dae7c8c3..2ee33d83275 100644
--- a/mysql-test/suite/wsrep/suite.pm
+++ b/mysql-test/suite/wsrep/suite.pm
@@ -1,16 +1,11 @@
package My::Suite::WSREP;
-use File::Basename;
-use My::Find;
-@ISA = qw(My::Suite);
-
-return "Not run for embedded server" if $::opt_embedded_server;
+use lib 'suite';
+use wsrep::common;
-return "WSREP is not compiled in" unless ::have_wsrep();
-
-return "No wsrep provider library" unless ::have_wsrep_provider();
+@ISA = qw(My::Suite);
-return ::wsrep_version_message() unless ::check_wsrep_version();
+return wsrep_not_ok() if wsrep_not_ok();
push @::global_suppressions,
(
diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
index 9170a337bf4..c7d4b0adf5b 100644
--- a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
+++ b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
@@ -4,15 +4,9 @@ use My::Find;
@ISA = qw(My::Suite);
-return "Not run for embedded server" if $::opt_embedded_server;
-
-return "WSREP is not compiled in" if not ::have_wsrep();
-
-return "No wsrep provider library" unless ::have_wsrep_provider();
-
-return ::wsrep_version_message() unless ::check_wsrep_version();
-
-return "No WSREP_INFO plugin" unless $ENV{WSREP_INFO_SO};
+use lib 'suite';
+use wsrep::common;
+return wsrep_not_ok() if wsrep_not_ok();
push @::global_suppressions,
(