summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/My/Config.pm16
-rw-r--r--mysql-test/lib/My/ConfigFactory.pm12
-rw-r--r--mysql-test/lib/My/Handles.pm12
-rw-r--r--mysql-test/lib/My/SafeProcess.pm13
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt39
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_kill_win.cc152
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc2
-rw-r--r--mysql-test/lib/My/SafeProcess/wsrep_check_version.c123
-rwxr-xr-xmysql-test/lib/generate-ssl-certs.sh37
-rw-r--r--mysql-test/lib/mtr_gcov.pl71
-rw-r--r--mysql-test/lib/mtr_report.pm60
-rwxr-xr-xmysql-test/lib/t/testMyConfig.t4
-rw-r--r--mysql-test/lib/v1/mtr_report.pl3
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl4
14 files changed, 414 insertions, 134 deletions
diff --git a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm
index 86bb7a5f961..c88b1170a80 100644
--- a/mysql-test/lib/My/Config.pm
+++ b/mysql-test/lib/My/Config.pm
@@ -21,6 +21,17 @@ use strict;
use warnings;
use Carp;
+# Define all MariaDB options that the user should be able to specify
+# many times in the config file. Note that options must be written
+# using '-' instead of '_' here!
+
+my %multipart_options=
+ (
+ "plugin-load-add" => 1,
+ "optimizer-switch" => 1,
+);
+
+
sub new {
my ($class, $option_name, $option_value)= @_;
my $self= bless { name => $option_name,
@@ -361,6 +372,11 @@ sub insert {
if ( defined $option ) {
#print "option: $option, value: $value\n";
+ my $tmp_option= $option;
+ $tmp_option =~ s/_/-/g;
+
+ # If the option is an option that one can specify many times, always add
+ $if_not_exist= 1 if ($multipart_options{$tmp_option});
# Add the option to the group
$group->insert($option, $value, $if_not_exist);
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
index a137bb9ca89..72d7600e8df 100644
--- a/mysql-test/lib/My/ConfigFactory.pm
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -197,7 +197,7 @@ my @mysqld_rules=
{ '#host' => \&fix_host },
{ 'port' => \&fix_port },
{ 'socket' => \&fix_socket },
- { '#log-error' => \&fix_log_error },
+ { 'log-error' => \&fix_log_error },
{ 'general-log' => 1 },
{ 'plugin-dir' => sub { $::plugindir } },
{ 'general-log-file' => \&fix_log },
@@ -311,7 +311,7 @@ sub post_check_client_groups {
$first_mysqld->name());
# Then generate [client.<suffix>] for each [mysqld.<suffix>]
- foreach my $mysqld ( $config->like('mysqld.') ) {
+ foreach my $mysqld ( $config->like('mysqld\.') ) {
$self->post_check_client_group($config,
'client'.$mysqld->after('mysqld'),
$mysqld->name())
@@ -333,12 +333,12 @@ sub post_check_embedded_group {
my $mysqld= $config->group('mysqld') or
croak "Can't run with embedded, config has no default mysqld section";
- my $first_mysqld= $config->first_like('mysqld.') or
+ my $first_mysqld= $config->first_like('mysqld\.') or
croak "Can't run with embedded, config has no mysqld";
my %no_copy = map { $_ => 1 }
(
- '#log-error', # Embedded server writes stderr to mysqltest's log file
+ '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
);
@@ -372,7 +372,7 @@ sub resolve_at_variable {
}
$res .= $after;
- $config->insert($group->name(), $option->name(), $res)
+ $option->{value}= $res;
}
@@ -457,7 +457,7 @@ sub new_config {
}
$self->run_section_rules($config,
- 'mysqld.',
+ 'mysqld\.',
@mysqld_rules);
# [mysqlbinlog] need additional settings
diff --git a/mysql-test/lib/My/Handles.pm b/mysql-test/lib/My/Handles.pm
index 3c9513fec8f..e23d3b75490 100644
--- a/mysql-test/lib/My/Handles.pm
+++ b/mysql-test/lib/My/Handles.pm
@@ -24,18 +24,20 @@ use My::Platform;
my $handle_exe;
-
-if (IS_WINDOWS){
+sub import {
+ my $self = shift;
+ my $params = shift;
+ return if (!IS_WINDOWS || $handle_exe);
# Check if handle.exe is available
# Pass switch to accept the EULA to avoid hanging
# if the program hasn't been run before.
my $list= `handle.exe -? -accepteula 2>&1`;
foreach my $line (split('\n', $list))
{
- $handle_exe= "$1.$2"
- if ($line =~ /Handle v([0-9]*)\.([0-9]*)/);
+ $handle_exe= "$2.$3"
+ if ($line =~ /(Nth|H)andle v([0-9]*)\.([0-9]*)/);
}
- if ($handle_exe){
+ if ($handle_exe && (!$params || !$params->{suppress_init_messages})){
print "Found handle.exe version $handle_exe\n";
}
}
diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
index 926d17ed66e..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);
}
@@ -336,9 +342,14 @@ sub start_kill {
sub dump_core {
my ($self)= @_;
- return if IS_WINDOWS;
my $pid= $self->{SAFE_PID};
die "Can't get core from not started process" unless defined $pid;
+
+ if (IS_WINDOWS) {
+ system("$safe_kill $pid dump");
+ return 1;
+ }
+
_verbose("Sending ABRT to $self");
kill ("ABRT", $pid);
return 1;
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
index 543e1dfb8f1..4c3b62fa67e 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -13,7 +13,21 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-IF (NOT INSTALL_MYSQLTESTDIR)
+
+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)
+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()
@@ -22,23 +36,12 @@ SET(INSTALL_ARGS
COMPONENT Test
)
-IF (WIN32)
- MYSQL_ADD_EXECUTABLE(my_safe_process safe_process_win.cc ${INSTALL_ARGS})
- MYSQL_ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc ${INSTALL_ARGS})
-ELSE()
- MYSQL_ADD_EXECUTABLE(my_safe_process safe_process.cc ${INSTALL_ARGS})
+INSTALL(TARGETS my_safe_process ${INSTALL_ARGS})
+IF(WITH_WSREP)
+ INSTALL(TARGETS wsrep_check_version ${INSTALL_ARGS})
ENDIF()
-
-INSTALL(TARGETS my_safe_process
- DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test
-)
-
-IF(WIN32)
- INSTALL(TARGETS my_safe_kill
- DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test
- )
+IF (WIN32)
+ INSTALL(TARGETS my_safe_kill ${INSTALL_ARGS})
ENDIF()
-INSTALL(FILES Base.pm
- DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test
-)
+INSTALL(FILES Base.pm ${INSTALL_ARGS})
diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
index a8c4011016b..bfd38928679 100644
--- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
@@ -25,6 +25,150 @@
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
+#include <psapi.h>
+
+#ifdef _MSC_VER
+/* Silence warning in OS header dbghelp.h */
+#pragma warning(push)
+#pragma warning(disable : 4091)
+#endif
+
+#include <dbghelp.h>
+
+#ifdef _MSC_VER
+/* Silence warning in OS header dbghelp.h */
+#pragma warning(pop)
+#endif
+
+#include <tlhelp32.h>
+#include <vector>
+
+
+static std::vector<DWORD> find_children(DWORD pid)
+{
+ HANDLE h= NULL;
+ PROCESSENTRY32 pe={ 0 };
+ std::vector<DWORD> children;
+
+ pe.dwSize = sizeof(PROCESSENTRY32);
+ h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if(h == INVALID_HANDLE_VALUE)
+ return children;
+
+ for (BOOL ret = Process32First(h, &pe); ret; ret = Process32Next(h, &pe))
+ {
+ if (pe.th32ParentProcessID == pid)
+ children.push_back(pe.th32ProcessID);
+ }
+ CloseHandle(h);
+ return children;
+}
+
+void dump_single_process(DWORD pid)
+{
+ HANDLE file = 0;
+ HANDLE process= 0;
+ DWORD size= MAX_PATH;
+ char path[MAX_PATH];
+ char working_dir[MAX_PATH];
+ char tmpname[MAX_PATH];
+
+ process= OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
+ if (!process)
+ {
+ fprintf(stderr, "safe_kill : cannot open process pid=%u to create dump, last error %u\n",
+ pid, GetLastError());
+ goto exit;
+ }
+
+ if (QueryFullProcessImageName(process, 0, path, &size) == 0)
+ {
+ fprintf(stderr, "safe_kill : cannot read process path for pid %u, last error %u\n",
+ pid, GetLastError());
+ goto exit;
+ }
+
+ char *filename= strrchr(path, '\\');
+ if (filename)
+ {
+ filename++;
+ // We are not interested in dump of some proceses (my_safe_process.exe,cmd.exe)
+ // since they are only used to start up other programs.
+ // We're interested however in their children;
+ const char *exclude_programs[] = {"my_safe_process.exe","cmd.exe", 0};
+ for(size_t i=0; exclude_programs[i]; i++)
+ if (_stricmp(filename, exclude_programs[i]) == 0)
+ goto exit;
+ }
+ else
+ filename= path;
+
+ // Add .dmp extension
+ char *p;
+ if ((p= strrchr(filename, '.')) == 0)
+ p= filename + strlen(filename);
+
+ strncpy(p, ".dmp", path + MAX_PATH - p);
+
+ // Íf file with this name exist, generate unique name with .dmp extension
+ if (GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES)
+ {
+ if (!GetTempFileName(".", filename, 0, tmpname))
+ {
+ fprintf(stderr, "GetTempFileName failed, last error %u", GetLastError());
+ goto exit;
+ }
+ strncat(tmpname, ".dmp", sizeof(tmpname));
+ filename= tmpname;
+ }
+
+
+ if (!GetCurrentDirectory(MAX_PATH, working_dir))
+ {
+ fprintf(stderr, "GetCurrentDirectory failed, last error %u", GetLastError());
+ goto exit;
+ }
+
+ file= CreateFile(filename, GENERIC_READ | GENERIC_WRITE,
+ 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+
+ if (file == INVALID_HANDLE_VALUE)
+ {
+ fprintf(stderr, "safe_kill : CreateFile() failed for file %s, working dir %s, last error = %u\n",
+ filename, working_dir, GetLastError());
+ goto exit;
+ }
+
+ if (!MiniDumpWriteDump(process, pid, file, MiniDumpNormal, 0, 0, 0))
+ {
+ fprintf(stderr, "Failed to write minidump to %s, working dir %s, last error %u\n",
+ filename, working_dir, GetLastError());
+ goto exit;
+ }
+
+ fprintf(stderr, "Minidump written to %s, directory %s\n", filename, working_dir);
+
+exit:
+ if (process != 0 && process != INVALID_HANDLE_VALUE)
+ CloseHandle(process);
+
+ if (file != 0 && file != INVALID_HANDLE_VALUE)
+ CloseHandle(file);
+}
+
+
+static int create_dump(DWORD pid, int recursion_depth= 5)
+{
+ if (recursion_depth < 0)
+ return 0;
+
+ dump_single_process(pid);
+ std::vector<DWORD> children= find_children(pid);
+ for(size_t i=0; i < children.size(); i++)
+ create_dump(children[i], recursion_depth -1);
+ return 0;
+}
+
int main(int argc, const char** argv )
{
@@ -37,12 +181,16 @@ int main(int argc, const char** argv )
signal(SIGBREAK, SIG_IGN);
signal(SIGTERM, SIG_IGN);
- if (argc != 2) {
- fprintf(stderr, "safe_kill <pid>\n");
+ if ((argc != 2 && argc != 3) || (argc == 3 && strcmp(argv[2],"dump"))) {
+ fprintf(stderr, "safe_kill <pid> [dump]\n");
exit(2);
}
pid= atoi(argv[1]);
+ if (argc == 3)
+ {
+ return create_dump(pid);
+ }
_snprintf(safe_process_name, sizeof(safe_process_name),
"safe_process[%d]", pid);
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index a63c1565228..13d09198a0c 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2008, 2012, Oracle and/or its affiliates
+ Copyright (c) 2019, MariaDB Corporation.
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
@@ -169,6 +170,7 @@ int main(int argc, char* const argv[] )
sigemptyset(&sa.sa_mask);
sa_abort.sa_handler= handle_abort;
+ sa_abort.sa_flags= 0;
sigemptyset(&sa_abort.sa_mask);
/* Install signal handlers */
sigaction(SIGTERM, &sa,NULL);
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..cec760738be
--- /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/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/lib/generate-ssl-certs.sh b/mysql-test/lib/generate-ssl-certs.sh
index 4b333854c08..7df1c2d8279 100755
--- a/mysql-test/lib/generate-ssl-certs.sh
+++ b/mysql-test/lib/generate-ssl-certs.sh
@@ -10,30 +10,49 @@ rm -rf demoCA
mkdir demoCA demoCA/newcerts
touch demoCA/index.txt
echo 01 > demoCA/serial
+echo 01 > demoCA/crlnumber
# CA certificate, self-signed
openssl req -x509 -newkey rsa:2048 -keyout cakey.pem -out cacert.pem -days 7300 -nodes -subj '/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' -text
# server certificate signing request and private key. Note the very long subject (for MDEV-7859)
-openssl req -newkey rsa:1024 -keyout server-key.pem -out demoCA/server-req.pem -days 7300 -nodes -subj '/CN=localhost/C=FI/ST=state or province within country, in other certificates in this file it is the same as L/L=location, usually an address but often ambiguously used/OU=organizational unit name, a division name within an organization/O=organization name, typically a company name'
+openssl req -newkey rsa:2048 -keyout server-key.pem -out demoCA/server-req.pem -days 7300 -nodes -subj '/CN=localhost/C=FI/ST=state or province within country, in other certificates in this file it is the same as L/L=location, usually an address but often ambiguously used/OU=organizational unit name, a division name within an organization/O=organization name, typically a company name'
# convert the key to yassl compatible format
openssl rsa -in server-key.pem -out server-key.pem
# sign the server certificate with CA certificate
-openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server-cert.pem -infiles demoCA/server-req.pem
+openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server-cert.pem -in demoCA/server-req.pem
+# server certificate with different validity period (MDEV-7598)
+openssl req -newkey rsa:2048 -keyout server-new-key.pem -out demoCA/server-new-req.pem -days 7301 -nodes -subj '/CN=server-new/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
+openssl rsa -in server-new-key.pem -out server-new-key.pem
+openssl ca -keyfile cakey.pem -days 7301 -batch -cert cacert.pem -policy policy_anything -out server-new-cert.pem -in demoCA/server-new-req.pem
+
+# 8K cert
openssl req -newkey rsa:8192 -keyout server8k-key.pem -out demoCA/server8k-req.pem -days 7300 -nodes -subj '/CN=server8k/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
openssl rsa -in server8k-key.pem -out server8k-key.pem
-openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server8k-cert.pem -infiles demoCA/server8k-req.pem
-
-openssl req -newkey rsa:1024 -keyout client-key.pem -out demoCA/client-req.pem -days 7300 -nodes -subj '/CN=client/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
-openssl rsa -in client-key.pem -out client-key.pem
-openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out client-cert.pem -infiles demoCA/client-req.pem
+openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server8k-cert.pem -in demoCA/server8k-req.pem
# with SubjectAltName, only for OpenSSL 1.0.2+
cat > demoCA/sanext.conf <<EOF
subjectAltName=IP:127.0.0.1, DNS:localhost
EOF
-openssl req -newkey rsa:1024 -keyout serversan-key.pem -out demoCA/serversan-req.pem -days 7300 -nodes -subj '/CN=server/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
-openssl ca -keyfile cakey.pem -extfile demoCA/sanext.conf -days 7300 -batch -cert cacert.pem -policy policy_anything -out serversan-cert.pem -infiles demoCA/serversan-req.pem
+openssl req -newkey rsa:2048 -keyout serversan-key.pem -out demoCA/serversan-req.pem -days 7300 -nodes -subj '/CN=server/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
+openssl ca -keyfile cakey.pem -extfile demoCA/sanext.conf -days 7300 -batch -cert cacert.pem -policy policy_anything -out serversan-cert.pem -in demoCA/serversan-req.pem
+
+# client cert
+openssl req -newkey rsa:2048 -keyout client-key.pem -out demoCA/client-req.pem -days 7300 -nodes -subj '/CN=client/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'
+openssl rsa -in client-key.pem -out client-key.pem
+openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out client-cert.pem -in demoCA/client-req.pem
+
+# generate crls
+openssl ca -revoke server-cert.pem -keyfile cakey.pem -batch -cert cacert.pem
+openssl ca -gencrl -keyfile cakey.pem -crldays 7300 -batch -cert cacert.pem -out server-cert.crl
+# we only want to have one certificate per CRL. Un-revoke server-cert.crl
+cp demoCA/index.txt.old demoCA/index.txt
+openssl ca -revoke client-cert.pem -keyfile cakey.pem -batch -cert cacert.pem
+openssl ca -gencrl -keyfile cakey.pem -crldays 7300 -batch -cert cacert.pem -out client-cert.crl
+
+rm -fv crldir/*
+cp -v client-cert.crl crldir/`openssl x509 -in client-cert.pem -noout -issuer_hash`.r0
rm -rf demoCA
diff --git a/mysql-test/lib/mtr_gcov.pl b/mysql-test/lib/mtr_gcov.pl
deleted file mode 100644
index bad4969f710..00000000000
--- a/mysql-test/lib/mtr_gcov.pl
+++ /dev/null
@@ -1,71 +0,0 @@
-# -*- cperl -*-
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
-#
-# 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 St, Fifth Floor, Boston, MA 02110-1335 USA
-
-# This is a library file used by the Perl version of mysql-test-run,
-# and is part of the translation of the Bourne shell script with the
-# same name.
-
-use strict;
-
-our $basedir;
-
-sub gcov_prepare ($) {
- my ($dir)= @_;
- print "Purging gcov information from '$dir'...\n";
-
- system("find $dir -name \*.gcov -o -name \*.da"
- . " -o -name \*.gcda | grep -v 'README.gcov\$' | xargs rm");
-}
-
-#
-# Collect gcov statistics.
-# Arguments:
-# $dir basedir, normally build directory
-# $gcov gcov utility program [path] name
-# $gcov_msg message file name
-# $gcov_err error file name
-#
-sub gcov_collect ($$$) {
- my ($dir, $gcov, $gcov_msg, $gcov_err)= @_;
-
- # Get current directory to return to later.
- my $start_dir= cwd();
-
- print "Collecting source coverage info using '$gcov'...$basedir\n";
- -f "$dir/$gcov_msg" and unlink("$dir/$gcov_msg");
- -f "$dir/$gcov_err" and unlink("$dir/$gcov_err");
-
- my @dirs= `find "$dir" -type d -print | sort`;
- #print "List of directories:\n@dirs\n";
-
- foreach my $d ( @dirs ) {
- chomp($d);
- chdir($d) or next;
-
- my @flist= glob("*.*.gcno");
- print ("Collecting in '$d'...\n") if @flist;
-
- foreach my $f (@flist) {
- system("$gcov $f 2>>$dir/$gcov_err >>$dir/$gcov_msg");
- system("perl", "$basedir/mysql-test/lib/process-purecov-annotations.pl", "$f.gcov");
- }
- chdir($start_dir);
- }
- print "gcov info in $dir/$gcov_msg, errors in $dir/$gcov_err\n";
-}
-
-
-1;
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
index e553b0305b4..a58fb369a13 100644
--- a/mysql-test/lib/mtr_report.pm
+++ b/mysql-test/lib/mtr_report.pm
@@ -37,8 +37,20 @@ use My::Platform;
use POSIX qw[ _exit ];
use IO::Handle qw[ flush ];
use mtr_results;
-
use Term::ANSIColor;
+use English;
+
+my $tot_real_time= 0;
+my $tests_done= 0;
+my $tests_failed= 0;
+
+our $timestamp= 0;
+our $timediff= 0;
+our $name;
+our $verbose;
+our $verbose_restart= 0;
+our $timer= 1;
+our $tests_total;
my %color_map = qw/pass green
retry-pass green
@@ -47,20 +59,39 @@ my %color_map = qw/pass green
disabled bright_black
skipped yellow
reset reset/;
-sub xterm_color {
- if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
- syswrite STDOUT, color($color_map{$_[0]});
+
+my $set_titlebar;
+my $set_color= sub { };
+
+if (-t STDOUT) {
+ if (IS_WINDOWS) {
+ eval {
+ require Win32::Console;
+ $set_titlebar = sub { &Win32::Console::Title($_[0]);};
+ }
+ } elsif ($ENV{TERM} =~ /xterm/) {
+ $set_titlebar = sub { syswrite STDOUT, "\e]0;$_[0]\a"; };
+ $set_color = sub { syswrite STDOUT, color($color_map{$_[0]}); }
}
}
-my $tot_real_time= 0;
+sub titlebar_stat($) {
-our $timestamp= 0;
-our $timediff= 0;
-our $name;
-our $verbose;
-our $verbose_restart= 0;
-our $timer= 1;
+ sub time_format($) {
+ sprintf '%d:%02d:%02d', $_[0]/3600, ($_[0]/60)%60, $_[0]%60;
+ }
+
+ $tests_done++;
+ $tests_failed++ if $_[0] =~ /fail/;
+ $tests_total++ if $_[0] =~ /retry/;
+
+ my $spent = time - $BASETIME;
+ my $left = $tests_total - $tests_done;
+
+ &$set_titlebar(sprintf "mtr: spent %s on %d tests. %s (%d tests) left, %d failed",
+ time_format($spent), $tests_done,
+ time_format($spent/$tests_done * $left), $left, $tests_failed);
+}
sub report_option {
my ($opt, $value)= @_;
@@ -321,8 +352,6 @@ sub mtr_report_stats ($$$$) {
if ( $timer )
{
- use English;
-
mtr_report("Spent", sprintf("%.3f", $tot_real_time),"of",
time - $BASETIME, "seconds executing testcases");
}
@@ -620,10 +649,11 @@ sub mtr_report (@) {
my @s = split /\[ (\S+) \]/, _name() . "@_\n";
if (@s > 1) {
print $s[0];
- xterm_color($s[1]);
+ &$set_color($s[1]);
print "[ $s[1] ]";
- xterm_color('reset');
+ &$set_color('reset');
print $s[2];
+ titlebar_stat($s[1]) if $set_titlebar;
} else {
print $s[0];
}
diff --git a/mysql-test/lib/t/testMyConfig.t b/mysql-test/lib/t/testMyConfig.t
index b373db0141a..99647c14ba1 100755
--- a/mysql-test/lib/t/testMyConfig.t
+++ b/mysql-test/lib/t/testMyConfig.t
@@ -129,10 +129,10 @@ my $config3= My::Config->new($test_include_cnf);
isa_ok( $config3, "My::Config" );
print $config3;
is( $config3->value('mysqld', 'basedir'), 'anotherbasedir',
- "mysqld_basedir has been overriden by value in test_include.cnf");
+ "mysqld_basedir has been overridden by value in test_include.cnf");
is( $config3->value('mysqld', 'option1'), 'values3',
- "mysqld_option1 has been overriden by value in test_include.cnf");
+ "mysqld_option1 has been overridden by value in test_include.cnf");
is( $config3->value('mysqld', 'option2'), 'value4',
"mysqld_option2 is from included file");
diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl
index e1f6bddb8a2..8964b0f8077 100644
--- a/mysql-test/lib/v1/mtr_report.pl
+++ b/mysql-test/lib/v1/mtr_report.pl
@@ -361,9 +361,6 @@ sub mtr_report_stats ($) {
/Slave: Can't DROP 'c7'.* 1091/ or
/Slave: Key column 'c6'.* 1072/ or
- # Warnings generated until bug#42147 is properly resolved
- /Found lock of type 6 that is write and read locked/ or
-
# rpl_idempotency.test produces warnings for the slave.
($testname eq 'rpl.rpl_idempotency' and
(/Slave: Can\'t find record in \'t1\' error.* 1032/ or
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index 2bc46e09025..6fe5f66fbfc 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -638,7 +638,7 @@ sub command_line_setup () {
if (! -f $glob_scriptname)
{
mtr_error("Can't find the location for the mysql-test-run script\n" .
- "Go to to the mysql-test directory and execute the script " .
+ "Go to the mysql-test directory and execute the script " .
"as follows:\n./$glob_scriptname");
}
@@ -4133,7 +4133,7 @@ sub valgrind_arguments {
if -f "$glob_mysql_test_dir/valgrind.supp";
}
- # Add valgrind options, can be overriden by user
+ # Add valgrind options, can be overridden by user
mtr_add_arg($args, '%s', $_) for (@valgrind_args);
mtr_add_arg($args, $$exe);