diff options
Diffstat (limited to 'mysql-test/lib/My')
-rw-r--r-- | mysql-test/lib/My/ConfigFactory.pm | 21 | ||||
-rw-r--r-- | mysql-test/lib/My/SafeProcess.pm | 6 | ||||
-rw-r--r-- | mysql-test/lib/My/SafeProcess/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mysql-test/lib/My/SafeProcess/wsrep_check_version.c | 134 |
4 files changed, 33 insertions, 130 deletions
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index 72d7600e8df..261de37ab54 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -209,13 +209,6 @@ my @mysqld_rules= { 'bind-address' => \&fix_bind_address }, ); -if (IS_WINDOWS) -{ - # For simplicity, we use the same names for shared memory and - # named pipes. - push(@mysqld_rules, {'shared-memory-base-name' => \&fix_socket}); -} - # # Rules to run for [client] section # - will be run in order listed here @@ -281,19 +274,6 @@ sub post_check_client_group { } $config->insert($client_group_name, $name_to, $option->value()) } - - if (IS_WINDOWS) - { - if (! $self->{ARGS}->{embedded}) - { - # Shared memory base may or may not be defined (e.g not defined in embedded) - my $shm = $group_to_copy_from->option("shared-memory-base-name"); - if (defined $shm) - { - $config->insert($client_group_name,"shared-memory-base-name", $shm->value()); - } - } - } } @@ -340,7 +320,6 @@ sub post_check_embedded_group { ( 'log-error', # Embedded server writes stderr to mysqltest's log file 'slave-net-timeout', # Embedded server are not build with replication - 'shared-memory-base-name', # No shared memory for embedded ); foreach my $option ( $mysqld->options(), $first_mysqld->options() ) { diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index 30c8fe54642..69033649b46 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 4946af7d899..0004a44982d 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..7398bc8ad92 100644 --- a/mysql-test/lib/My/SafeProcess/wsrep_check_version.c +++ b/mysql-test/lib/My/SafeProcess/wsrep_check_version.c @@ -1,5 +1,4 @@ -/* 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. @@ -14,110 +13,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; -} +#include "../../../../wsrep-lib/wsrep-API/v26/wsrep_api.h" 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 |