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.pm2
-rw-r--r--mysql-test/lib/My/ConfigFactory.pm12
-rw-r--r--mysql-test/lib/My/CoreDump.pm14
-rw-r--r--mysql-test/lib/My/SafeProcess.pm4
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc14
-rw-r--r--mysql-test/lib/mtr_cases.pm42
-rw-r--r--mysql-test/lib/v1/mtr_report.pl12
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl2
8 files changed, 71 insertions, 31 deletions
diff --git a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm
index e5469d8c62e..12647edf0a4 100644
--- a/mysql-test/lib/My/Config.pm
+++ b/mysql-test/lib/My/Config.pm
@@ -47,7 +47,7 @@ sub option {
my $value= $self->{value};
my $opt= $name;
- $opt= "$name=$value" if ($value);
+ $opt= "$name=$value" if (defined $value);
$opt= "--$opt" unless ($opt =~ /^--/);
return $opt;
}
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
index f43fc9c1f16..7f8bb163246 100644
--- a/mysql-test/lib/My/ConfigFactory.pm
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -37,7 +37,7 @@ sub add_opt_values {
# add auto-options
$config->insert('OPT', 'port' => sub { fix_port($self, $config) });
- $config->insert('mysqld', "loose-skip-$_" => undef) for (@::optional_plugins);
+ $config->insert('mysqld', "loose-skip-plugin-$_" => undef) for (@::optional_plugins);
}
my @pre_rules=
@@ -169,6 +169,13 @@ sub fix_log {
return "$dir/mysqld.log";
}
+sub fix_bind_address {
+ if (IS_WINDOWS) {
+ return "*";
+ } else {
+ return "127.0.0.1";
+ }
+}
sub fix_log_slow_queries {
my ($self, $config, $group_name, $group)= @_;
my $dir= dirname($group->value('datadir'));
@@ -251,6 +258,7 @@ my @mysqld_rules=
{ 'ssl-ca' => \&fix_ssl_ca },
{ 'ssl-cert' => \&fix_ssl_server_cert },
{ 'ssl-key' => \&fix_ssl_server_key },
+ { 'bind-address' => \&fix_bind_address },
);
if (IS_WINDOWS)
@@ -325,6 +333,7 @@ my @cluster_config_rules=
#
my @client_rules=
(
+ { 'character-sets-dir' => \&fix_charset_dir },
);
@@ -347,7 +356,6 @@ my @mysqltest_rules=
#
my @mysqlbinlog_rules=
(
- { 'character-sets-dir' => \&fix_charset_dir },
);
diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm
index 1d6d85020c8..1ba94223b68 100644
--- a/mysql-test/lib/My/CoreDump.pm
+++ b/mysql-test/lib/My/CoreDump.pm
@@ -53,9 +53,19 @@ sub _verify_binpath {
sub _gdb {
my ($core_name)= @_;
- print "\nTrying 'gdb' to get a backtrace\n";
+ # Check that gdb exists
+ `gdb --version`;
+ if ($?) {
+ print "gdb not found, cannot get the stack trace\n";
+ return;
+ }
- return unless -f $core_name;
+ if (-f $core_name) {
+ print "\nTrying 'gdb' to get a backtrace from coredump $core_name\n";
+ } else {
+ print "\nCoredump $core_name does not exist, cannot run 'gdb'\n";
+ return;
+ }
# Find out name of binary that generated core
`gdb -c '$core_name' --batch 2>&1` =~
diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
index 02467971e77..926d17ed66e 100644
--- a/mysql-test/lib/My/SafeProcess.pm
+++ b/mysql-test/lib/My/SafeProcess.pm
@@ -34,7 +34,7 @@ package My::SafeProcess;
# will zap the "monitored process" and exit
# - the "monitored process" to exit, in which case it will exit
# itself with same exit code as the "monitored process"
-# - the parent process to send the "shutdown" signal in wich case
+# - the parent process to send the "shutdown" signal in which case
# monitor will kill the "monitored process" hard and exit
#
#
@@ -338,7 +338,7 @@ sub dump_core {
my ($self)= @_;
return if IS_WINDOWS;
my $pid= $self->{SAFE_PID};
- die "Can't cet core from not started process" unless defined $pid;
+ die "Can't get core from not started process" unless defined $pid;
_verbose("Sending ABRT to $self");
kill ("ABRT", $pid);
return 1;
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index 147dfdec226..77f3974540d 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -89,7 +89,7 @@ static void die(const char* fmt, ...)
}
-static void kill_child(bool was_killed)
+static int kill_child(bool was_killed)
{
int status= 0;
@@ -108,15 +108,15 @@ static void kill_child(bool was_killed)
exit_code= WEXITSTATUS(status);
message("Child exit: %d", exit_code);
// Exit with exit status of the child
- exit(exit_code);
+ return exit_code;
}
if (WIFSIGNALED(status))
message("Child killed by signal: %d", WTERMSIG(status));
- exit(exit_code);
+ return exit_code;
}
- exit(5);
+ return 5;
}
@@ -136,7 +136,7 @@ extern "C" void handle_signal(int sig)
terminated= 1;
if (child_pid > 0)
- kill_child(sig == SIGCHLD);
+ _exit(kill_child(sig == SIGCHLD));
// Ignore further signals
signal(SIGTERM, SIG_IGN);
@@ -292,8 +292,6 @@ int main(int argc, char* const argv[] )
/* Wait for parent or child to die */
sleep(1);
}
- kill_child(0);
-
- return 4;
+ return kill_child(0);
}
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 4ebe12772f0..79a63b72532 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -248,6 +248,7 @@ sub load_suite_object {
unless (defined $suites{$suitename}) {
if (-f "$suitedir/suite.pm") {
$suite= do "$suitedir/suite.pm";
+ mtr_error("Cannot load $suitedir/suite.pm: $@") if $@;
unless (ref $suite) {
my $comment = $suite;
$suite = My::Suite->new();
@@ -310,6 +311,7 @@ sub combinations_from_file($$)
}
our %disabled;
+our %disabled_wildcards;
sub parse_disabled {
my ($filename, $suitename) = @_;
@@ -318,10 +320,18 @@ sub parse_disabled {
chomp;
next if /^\s*#/ or /^\s*$/;
mtr_error("Syntax error in $filename line $.")
- unless /^\s*(?:([-0-9A-Za-z_]+)\.)?([-0-9A-Za-z_]+)\s*:\s*(.*?)\s*$/;
- mtr_error("Wrong suite name in $filename line $.")
+ unless /^\s*(?:([-0-9A-Za-z_\/]+)\.)?([-0-9A-Za-z_\*]+)\s*:\s*(.*?)\s*$/;
+ mtr_error("Wrong suite name in $filename line $.: suitename = $suitename but the file says $1")
if defined $1 and defined $suitename and $1 ne $suitename;
- $disabled{($1 || $suitename || '') . ".$2"} = $3;
+ my ($sname, $casename, $text)= (($1 || $suitename || ''), $2, $3);
+
+ if ($casename =~ /\*/) {
+ # Wildcard
+ $disabled_wildcards{$sname . ".$casename"}= $text;
+ }
+ else {
+ $disabled{$sname . ".$casename"}= $text;
+ }
}
close DISABLED;
}
@@ -334,15 +344,20 @@ sub parse_disabled {
#
sub collect_default_suites(@)
{
- my @dirs = my_find_dir(dirname($::glob_mysql_test_dir),
- [ @plugin_suitedirs ], '*');
- for my $d (@dirs) {
- next unless -f "$d/suite.pm";
- my $sname= basename($d);
+ use File::Find;
+ my @dirs;
+ find(sub {
+ push @dirs, [$File::Find::topdir, $File::Find::name]
+ if -d and -f "$File::Find::name/suite.pm";
+ }, my_find_dir(dirname($::glob_mysql_test_dir), \@plugin_suitedirs));
+
+ for (@dirs) {
+ my ($plugin_root, $dir) = @$_;
+ my $sname= substr $dir, 1 + length $plugin_root;
# ignore overlays here, otherwise we'd need accurate
# duplicate detection with overlay support for the default suite list
next if $sname eq 'main' or -d "$::glob_mysql_test_dir/suite/$sname";
- my $s = load_suite_object($sname, $d);
+ my $s = load_suite_object($sname, $dir);
push @_, $sname if $s->is_default();
}
return @_;
@@ -490,6 +505,7 @@ sub process_suite {
# disabled.def
parse_disabled($suite->{dir} .'/disabled.def', $suitename);
+ parse_disabled($suite->{dir} .'/t/disabled.def', $suitename);
# combinations
if (@::opt_combinations)
@@ -712,6 +728,14 @@ sub collect_one_test_case {
# Check for disabled tests
# ----------------------------------------------------------------------
my $disable = $disabled{".$tname"} || $disabled{$name};
+ if (not $disable) {
+ foreach my $w (keys %disabled_wildcards) {
+ if ($name =~ /^$w/) {
+ $disable= $disabled_wildcards{$w};
+ last;
+ }
+ }
+ }
if (not defined $disable and $suite->{parent}) {
$disable = $disabled{$suite->{parent}->{name} . ".$tname"};
}
diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl
index ab856d68d0c..af9195b5f0a 100644
--- a/mysql-test/lib/v1/mtr_report.pl
+++ b/mysql-test/lib/v1/mtr_report.pl
@@ -309,10 +309,10 @@ sub mtr_report_stats ($) {
/Slave: Query caused different errors on master and slave/ or
/Slave: Table .* doesn't exist/ or
/Slave: Table width mismatch/ or
- /Slave: The incident LOST_EVENTS occured on the master/ or
+ /Slave: The incident LOST_EVENTS occurred on the master/ or
/Slave: Unknown error.* 1105/ or
/Slave: Can't drop database.* database doesn't exist/ or
- /Slave SQL:.*(?:Error_code: \d+|Query:.*)/ or
+ /Slave SQL:.*(?:error.* \d+|Query:.*)/ or
/Sort aborted/ or
/Time-out in NDB/ or
/One can only use the --user.*root/ or
@@ -361,7 +361,7 @@ sub mtr_report_stats ($) {
# rpl_extrColmaster_*.test, the slave thread produces warnings
# when it get updates to a table that has more columns on the
# master
- /Slave: Unknown column 'c7' in 't15' Error_code: 1054/ or
+ /Slave: Unknown column 'c7' in 't15' error.* 1054/ or
/Slave: Can't DROP 'c7'.* 1091/ or
/Slave: Key column 'c6'.* 1072/ or
@@ -370,8 +370,8 @@ sub mtr_report_stats ($) {
# rpl_idempotency.test produces warnings for the slave.
($testname eq 'rpl.rpl_idempotency' and
- (/Slave: Can\'t find record in \'t1\' Error_code: 1032/ or
- /Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452/
+ (/Slave: Can\'t find record in \'t1\' error.* 1032/ or
+ /Slave: Cannot add or update a child row: a foreign key constraint fails .* error.* 1452/
)) or
# These tests does "kill" on queries, causing sporadic errors when writing to logs
@@ -389,7 +389,7 @@ sub mtr_report_stats ($) {
# rpl_temporary has an error on slave that can be ignored
($testname eq 'rpl.rpl_temporary' and
- (/Slave: Can\'t find record in \'user\' Error_code: 1032/
+ (/Slave: Can\'t find record in \'user\' error.* 1032/
)) or
# Test case for Bug#31590 produces the following error:
/Out of sort memory; increase server sort buffer size/ or
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index ec05660b4d5..99d050d18d0 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -3220,7 +3220,7 @@ sub install_db ($$) {
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
# Use the mysql database for system tables
- mtr_tofile($bootstrap_sql_file, "use mysql");
+ mtr_tofile($bootstrap_sql_file, "use mysql;\n");
# Add the offical mysql system tables
# for a production system