summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/My/ConfigFactory.pm9
-rw-r--r--mysql-test/lib/My/CoreDump.pm10
-rw-r--r--mysql-test/lib/My/Find.pm20
-rw-r--r--mysql-test/lib/My/Handles.pm3
-rw-r--r--mysql-test/lib/My/Options.pm22
-rw-r--r--mysql-test/lib/My/SafeProcess.pm14
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt5
-rw-r--r--mysql-test/lib/My/SafeProcess/Makefile.am26
-rw-r--r--[-rwxr-xr-x]mysql-test/lib/My/SafeProcess/safe_kill_win.cc7
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc14
-rw-r--r--[-rwxr-xr-x]mysql-test/lib/My/SafeProcess/safe_process_win.cc15
-rw-r--r--mysql-test/lib/My/Suite.pm13
-rw-r--r--mysql-test/lib/My/Test.pm28
-rw-r--r--mysql-test/lib/mtr_cases.pm240
-rw-r--r--mysql-test/lib/mtr_gcov.pl26
-rw-r--r--mysql-test/lib/mtr_misc.pl128
-rw-r--r--mysql-test/lib/mtr_process.pl17
-rw-r--r--mysql-test/lib/mtr_report.pm32
-rw-r--r--mysql-test/lib/mtr_results.pm167
-rw-r--r--mysql-test/lib/t/Options.t17
-rwxr-xr-xmysql-test/lib/t/testMyConfigFactory.t8
-rw-r--r--mysql-test/lib/v1/mtr_io.pl5
-rw-r--r--mysql-test/lib/v1/mtr_misc.pl4
-rw-r--r--mysql-test/lib/v1/mtr_report.pl46
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl233
25 files changed, 669 insertions, 440 deletions
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
index 90c0ee4ecfb..73bad5bd81d 100644
--- a/mysql-test/lib/My/ConfigFactory.pm
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -72,7 +72,7 @@ sub fix_charset_dir {
sub fix_language {
my ($self, $config, $group_name, $group)= @_;
return my_find_dir($self->get_bindir($group),
- \@share_locations, "english");
+ \@share_locations);
}
sub fix_datadir {
@@ -229,16 +229,13 @@ my @mysqld_rules=
(
{ 'basedir' => sub { return shift->{ARGS}->{basedir}; } },
{ 'tmpdir' => \&fix_tmpdir },
- { 'log-basename' => sub { return "mysqld" } },
{ 'character-sets-dir' => \&fix_charset_dir },
- { 'language' => \&fix_language },
+ { 'lc-messages-dir' => \&fix_language },
{ 'datadir' => \&fix_datadir },
{ 'pid-file' => \&fix_pidfile },
{ '#host' => \&fix_host },
{ 'port' => \&fix_port },
- { '#extra-port' => \&fix_port },
{ 'socket' => \&fix_socket },
- { 'log-error' => \&fix_log_error },
{ '#log-error' => \&fix_log_error },
{ 'general-log' => sub { return 1; } },
{ 'general-log-file' => \&fix_log },
@@ -247,7 +244,6 @@ my @mysqld_rules=
{ '#user' => sub { return shift->{ARGS}->{user} || ""; } },
{ '#password' => sub { return shift->{ARGS}->{password} || ""; } },
{ 'server-id' => \&fix_server_id, },
- { 'sync-sys' => sub { return 1; } },
# By default, prevent the started mysqld to access files outside of vardir
{ 'secure-file-priv' => sub { return shift->{ARGS}->{vardir}; } },
{ 'ssl-ca' => \&fix_ssl_ca },
@@ -648,6 +644,7 @@ sub new_config {
# add auto-options
$config->insert('OPT', 'port' => sub { fix_port($self, $config) });
$config->insert('OPT', 'vardir' => sub { $self->{ARGS}->{vardir} });
+ $config->insert('OPT', 'plugindir' => sub { $::plugindir });
{
# Run pre rules
diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm
index 0954602f1d4..419a0e7f39f 100644
--- a/mysql-test/lib/My/CoreDump.pm
+++ b/mysql-test/lib/My/CoreDump.pm
@@ -1,6 +1,5 @@
# -*- cperl -*-
-# Copyright (c) 2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2008, 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
@@ -22,6 +21,7 @@ use Carp;
use My::Platform;
use File::Temp qw/ tempfile tempdir /;
+use mtr_results;
my $hint_mysqld; # Last resort guess for executable path
@@ -81,7 +81,7 @@ sub _gdb {
return if $? >> 8;
return unless $gdb_output;
- print <<EOF, $gdb_output, "\n";
+ resfile_print <<EOF . $gdb_output . "\n";
Output from gdb follows. The first stack trace is from the failing thread.
The following stack traces are from all threads (so the failing one is
duplicated).
@@ -125,7 +125,7 @@ sub _dbx {
return if $? >> 8;
return unless $dbx_output;
- print <<EOF, $dbx_output, "\n";
+ resfile_print <<EOF . $dbx_output . "\n";
Output from dbx follows. Stack trace is printed for all threads in order,
above this you should see info about which thread was the failing one.
----------------------------
@@ -245,7 +245,7 @@ sub _cdb {
$cdb_output=~ s/^Child\-SP RetAddr Call Site//gm;
$cdb_output=~ s/\+0x([0-9a-fA-F]+)//gm;
- print <<EOF, $cdb_output, "\n";
+ resfile_print <<EOF . $cdb_output . "\n";
Output from cdb follows. Faulting thread is printed twice,with and without function parameters
Search for STACK_TEXT to see the stack trace of
the faulting thread. Callstacks of other threads are printed after it.
diff --git a/mysql-test/lib/My/Find.pm b/mysql-test/lib/My/Find.pm
index 5dea0537bc6..bd153becaf7 100644
--- a/mysql-test/lib/My/Find.pm
+++ b/mysql-test/lib/My/Find.pm
@@ -165,16 +165,16 @@ sub my_find_paths {
}
# -------------------------------------------------------
- # Windows specific
- # -------------------------------------------------------
- if (IS_WINDOWS) {
- # Add the default extra build dirs unless a specific one has
- # already been selected
- push(@extra_dirs,
- ("release",
- "relwithdebinfo",
- "debug")) if @extra_dirs == 0;
- }
+ # CMake generator specific (Visual Studio and Xcode have multimode builds)
+ # -------------------------------------------------------
+
+ # Add the default extra build dirs unless a specific one has
+ # already been selected
+ push(@extra_dirs,
+ ("Release",
+ "Relwithdebinfo",
+ "Debug")) if @extra_dirs == 0;
+
#print "extra_build_dir: @extra_dirs\n";
diff --git a/mysql-test/lib/My/Handles.pm b/mysql-test/lib/My/Handles.pm
index 00cd3126174..d120eb7b1d4 100644
--- a/mysql-test/lib/My/Handles.pm
+++ b/mysql-test/lib/My/Handles.pm
@@ -1,6 +1,5 @@
# -*- cperl -*-
-# Copyright (c) 2008 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, 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
diff --git a/mysql-test/lib/My/Options.pm b/mysql-test/lib/My/Options.pm
index a0713f7c07e..ff3992ecb2e 100644
--- a/mysql-test/lib/My/Options.pm
+++ b/mysql-test/lib/My/Options.pm
@@ -1,5 +1,5 @@
# -*- cperl -*-
-# Copyright (C) 2008 MySQL AB
+# Copyright (c) 2008, 2010, 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
@@ -67,9 +67,6 @@ sub _split_option {
elsif ($option=~ /^(.*)=(.*)$/){
return ($1, $2)
}
- elsif ($option=~ /^-O$/){
- return (undef, undef);
- }
die "Unknown option format '$option'";
}
@@ -169,20 +166,11 @@ sub toSQL {
my @sql;
foreach my $option (@options) {
- my ($name, $value)= _split_option($option);
- #print "name: $name\n";
+ my ($sql_name, $value)= _split_option($option);
+ #print "name: $sql_name\n";
#print "value: $value\n";
- if ($name =~ /^O, (.*)/){
- push(@sql, "SET GLOBAL $1=$value");
- }
- elsif ($name =~ /^set-variable=(.*)/){
- push(@sql, "SET GLOBAL $1=$value");
- }
- else {
- my $sql_name= $name;
- $sql_name=~ s/-/_/g;
- push(@sql, "SET GLOBAL $sql_name=$value");
- }
+ $sql_name=~ s/-/_/g;
+ push(@sql, "SET GLOBAL $sql_name=$value");
}
return join("; ", @sql);
}
diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
index baeb452fde0..e7917f8fb16 100644
--- a/mysql-test/lib/My/SafeProcess.pm
+++ b/mysql-test/lib/My/SafeProcess.pm
@@ -1,5 +1,5 @@
# -*- cperl -*-
-# Copyright (c) 2008, 2010, Oracle and/or its affiliates.
+# Copyright (c) 2007, 2011, Oracle and/or its affiliates.
# Copyright (c) 2009, 2011 Monty Program Ab
#
# This program is free software; you can redistribute it and/or
@@ -87,6 +87,7 @@ sub is_child {
my @safe_process_cmd;
my $safe_kill;
my $bindir;
+
if(defined $ENV{MTR_BINDIR})
{
# This is an out-of-source build. Build directory
@@ -95,7 +96,8 @@ if(defined $ENV{MTR_BINDIR})
}
else
{
- $bindir = ".";
+ use Cwd;
+ $bindir = getcwd();
}
# Find the safe process binary or script
@@ -139,6 +141,7 @@ sub new {
my $host = delete($opts{'host'});
my $shutdown = delete($opts{'shutdown'});
my $user_data= delete($opts{'user_data'});
+ my $envs = delete($opts{'envs'});
# if (defined $host) {
# $safe_script= "lib/My/SafeProcess/safe_process_cpcd.pl";
@@ -161,6 +164,13 @@ sub new {
# Point the safe_process at the right parent if running on cygwin
push(@safe_args, "--parent-pid=".Cygwin::pid_to_winpid($$)) if IS_CYGWIN;
+ foreach my $env_var (@$envs) {
+ croak("Missing = in env string") unless $env_var =~ /=/;
+ croak("Env string $env_var seen, probably missing value for --mysqld-env")
+ if $env_var =~ /^--/;
+ push @safe_args, "--env $env_var";
+ }
+
push(@safe_args, "--");
push(@safe_args, $path); # The program safe_process should execute
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
index 6edf9d45683..810096805c8 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -1,4 +1,3 @@
-# Copyright (C) 2008 MySQL AB
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
@@ -26,4 +25,8 @@ ELSE()
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process.cc ${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)
+ENDIF()
INSTALL(FILES safe_process.pl Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
diff --git a/mysql-test/lib/My/SafeProcess/Makefile.am b/mysql-test/lib/My/SafeProcess/Makefile.am
deleted file mode 100644
index f9ee35ea28c..00000000000
--- a/mysql-test/lib/My/SafeProcess/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2008 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
-#
-# 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-1301 USA
-
-testroot = $(prefix)
-safedir = $(testroot)/mysql-test/lib/My/SafeProcess
-#nobase_bin_PROGRAMS = ...
-safe_PROGRAMS = my_safe_process
-
-my_safe_process_SOURCES = safe_process.cc
-
-EXTRA_DIST = safe_kill_win.cc \
- safe_process_win.cc \
- CMakeLists.txt
diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
index f69c1a109a9..2ac29c61bc7 100755..100644
--- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
@@ -1,5 +1,4 @@
-/* Copyright (c) 2007, 2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+/* Copyright (c) 2007, 2010, 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
@@ -12,8 +11,7 @@
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-1301 USA
-*/
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
@@ -26,6 +24,7 @@
#include <windows.h>
#include <stdio.h>
#include <signal.h>
+#include <stdlib.h>
int main(int argc, const char** argv )
{
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index 4aedba3f3c1..ffe11417e7d 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates
+/* Copyright (c) 2008, 2011, Oracle and/or its affiliates
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
@@ -11,8 +11,7 @@
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-1301 USA
-*/
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
@@ -177,7 +176,7 @@ int main(int argc, char* const argv[] )
} else {
if ( strcmp(arg, "--verbose") == 0 )
verbose++;
- else if ( strncmp(arg, "--parent-pid", 10) == 0 )
+ else if ( strncmp(arg, "--parent-pid", 12) == 0 )
{
/* Override parent_pid with a value provided by user */
const char* start;
@@ -186,10 +185,15 @@ int main(int argc, char* const argv[] )
start++; /* Step past = */
if ((parent_pid= atoi(start)) == 0)
die("Invalid value '%s' passed to --parent-id", start);
- } else if ( strcmp(arg, "--nocore") == 0 )
+ }
+ else if ( strcmp(arg, "--nocore") == 0 )
{
nocore = true; // Don't allow the process to dump core
}
+ else if ( strncmp (arg, "--env ", 6) == 0 )
+ {
+ putenv(strdup(arg+6));
+ }
else
die("Unknown option: %s", arg);
}
diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
index a8d519fe8e3..87a14481e25 100755..100644
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
@@ -1,5 +1,4 @@
-/* Copyright (c) 2007, 2008 MySQL AB, 2009, 2010 Sun Microsystems, Inc.
- Use is subject to license terms.
+/* Copyright (c) 2007, 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
@@ -12,8 +11,7 @@
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-1301 USA
-*/
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
@@ -56,6 +54,7 @@
#include <stdio.h>
#include <tlhelp32.h>
#include <signal.h>
+#include <stdlib.h>
static int verbose= 0;
static char safe_process_name[32]= {0};
@@ -221,6 +220,10 @@ int main(int argc, const char** argv )
{
nocore= TRUE;
}
+ else if ( strncmp (arg, "--env ", 6) == 0 )
+ {
+ putenv(strdup(arg+6));
+ }
else
die("Unknown option: %s", arg);
}
@@ -253,6 +256,10 @@ int main(int argc, const char** argv )
Make all processes associated with the job terminate when the
last handle to the job is closed.
*/
+#ifndef JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE
+#define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000
+#endif
+
jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
if (SetInformationJobObject(job_handle, JobObjectExtendedLimitInformation,
&jeli, sizeof(jeli)) == 0)
diff --git a/mysql-test/lib/My/Suite.pm b/mysql-test/lib/My/Suite.pm
index 69609e1c4f5..c63e633ec3b 100644
--- a/mysql-test/lib/My/Suite.pm
+++ b/mysql-test/lib/My/Suite.pm
@@ -6,5 +6,18 @@ package My::Suite;
sub config_files { () }
sub servers { () }
+sub list_cases {
+ my ($self, $testdir) = @_;
+ opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!");
+ my (@cases) = grep { s/\.test$// } readdir TESTDIR;
+ closedir TESTDIR;
+ @cases;
+}
+
+sub start_test {
+ my ($self, $tinfo)= @_;
+ &::start_mysqltest($tinfo);
+}
+
bless { };
diff --git a/mysql-test/lib/My/Test.pm b/mysql-test/lib/My/Test.pm
index 012e5f6d81e..04dccfdaa4a 100644
--- a/mysql-test/lib/My/Test.pm
+++ b/mysql-test/lib/My/Test.pm
@@ -1,7 +1,6 @@
# -*- cperl -*-
-# Copyright (c) 2008 MySQL AB, 2008 Sun Microsystems, Inc.
-# Use is subject to license terms.
-#
+# Copyright (c) 2008, 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.
@@ -25,6 +24,7 @@ use strict;
use warnings;
use Carp;
use Storable();
+use mtr_results;
sub new {
@@ -62,9 +62,26 @@ sub is_failed {
}
+my %result_names= (
+ 'MTR_RES_PASSED' => 'pass',
+ 'MTR_RES_FAILED' => 'fail',
+ 'MTR_RES_SKIPPED' => 'skipped',
+ );
+
sub write_test {
my ($test, $sock, $header)= @_;
+ if ($::opt_resfile && defined $test->{'result'}) {
+ resfile_test_info("result", $result_names{$test->{'result'}});
+ if ($test->{'timeout'}) {
+ resfile_test_info("comment", "Timeout");
+ } elsif (defined $test->{'comment'}) {
+ resfile_test_info("comment", $test->{'comment'});
+ }
+ resfile_test_info("result", "warning") if defined $test->{'check'};
+ resfile_to_test($test);
+ }
+
# Give the test a unique key before serializing it
$test->{key}= "$test" unless defined $test->{key};
@@ -80,10 +97,11 @@ sub read_test {
chomp($serialized);
$serialized =~ s/\\([0-9a-fA-F]{2})/chr(hex($1))/eg;
my $test= Storable::thaw($serialized);
- die "wrong class (hack attempt?)"
+ use Data::Dumper;
+ die "wrong class (hack attempt?): ".ref($test)."\n".Dumper(\$test)
unless ref($test) eq 'My::Test';
+ resfile_from_test($test) if $::opt_resfile;
return $test;
}
-
1;
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 6acbe623e22..3c8d3059713 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -1,5 +1,6 @@
# -*- cperl -*-
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates
+# Copyright (c) 2005, 2011, Oracle and/or its affiliates.
+# Copyright (c) 2010, 2011 Monty Program Ab
#
# 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
@@ -110,10 +111,11 @@ sub testcase_sort_order {
#
##############################################################################
-sub collect_test_cases ($$$) {
+sub collect_test_cases ($$$$) {
my $opt_reorder= shift; # True if we're reordering tests
my $suites= shift; # Semicolon separated list of test suites
my $opt_cases= shift;
+ my $opt_skip_test_list= shift;
my $cases= []; # Array of hash(one hash for each testcase)
$do_test_reg= init_pattern($do_test, "--do-test");
@@ -126,7 +128,7 @@ sub collect_test_cases ($$$) {
{
foreach my $suite (split(",", $suites))
{
- push(@$cases, collect_one_suite($suite, $opt_cases));
+ push(@$cases, collect_one_suite($suite, $opt_cases, $opt_skip_test_list));
last if $some_test_found;
}
}
@@ -139,7 +141,7 @@ sub collect_test_cases ($$$) {
foreach my $test_name_spec ( @$opt_cases )
{
my $found= 0;
- my ($sname, $tname, $extension)= split_testname($test_name_spec);
+ my ($sname, $tname)= split_testname($test_name_spec);
foreach my $test ( @$cases )
{
last unless $opt_reorder;
@@ -222,7 +224,7 @@ sub collect_test_cases ($$$) {
}
-# Returns (suitename, testname, extension)
+# Returns (suitename, testname)
sub split_testname {
my ($test_name)= @_;
@@ -234,24 +236,19 @@ sub split_testname {
if (@parts == 1){
# Only testname given, ex: alias
- return (undef , $parts[0], undef);
+ return (undef , $parts[0]);
} elsif (@parts == 2) {
# Either testname.test or suite.testname given
# Ex. main.alias or alias.test
if ($parts[1] eq "test")
{
- return (undef , $parts[0], $parts[1]);
+ return (undef , $parts[0]);
}
else
{
- return ($parts[0], $parts[1], undef);
+ return ($parts[0], $parts[1]);
}
-
- } elsif (@parts == 3) {
- # Fully specified suitename.testname.test
- # ex main.alias.test
- return ( $parts[0], $parts[1], $parts[2]);
}
mtr_error("Illegal format of test name: $test_name");
@@ -262,6 +259,7 @@ sub collect_one_suite
{
my $suite= shift; # Test suite name
my $opt_cases= shift;
+ my $opt_skip_test_list= shift;
my @cases; # Array of hash
mtr_verbose("Collecting: $suite");
@@ -278,13 +276,16 @@ sub collect_one_suite
}
else
{
- $suitedir= my_find_dir($suitedir,
- ["suite",
- ".",
+ $suitedir= my_find_dir($::basedir,
+ ["share/mysql-test/suite",
+ "mysql-test/suite",
+ "mysql-test",
# Look in storage engine specific suite dirs
- "../storage/*/mysql-test-suites"
+ "storage/*/mtr",
+ # Look in plugin specific suite dir
+ "plugin/$suite/tests",
],
- [$suite]);
+ [$suite, "mtr"]);
}
mtr_verbose("suitedir: $suitedir");
}
@@ -333,117 +334,94 @@ sub collect_one_suite
# Build a hash of disabled testcases for this suite
# ----------------------------------------------------------------------
my %disabled;
- if ( open(DISABLED, "$testdir/disabled.def" ) )
- {
- # $^O on Windows considered not generic enough
- my $plat= (IS_WINDOWS) ? 'windows' : $^O;
-
- while ( <DISABLED> )
- {
- chomp;
- #diasble the test case if platform matches
- if ( /\@/ )
- {
- if ( /\@$plat/ )
- {
- /^\s*(\S+)\s*\@$plat.*:\s*(.*?)\s*$/ ;
- $disabled{$1}= $2;
- }
- elsif ( /\@!(\S*)/ )
- {
- if ( $1 ne $plat)
- {
- /^\s*(\S+)\s*\@!.*:\s*(.*?)\s*$/ ;
- $disabled{$1}= $2;
- }
- }
- }
- elsif ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
- {
- $disabled{$1}= $2;
- }
- }
- close DISABLED;
- }
+ my @disabled_collection= @{$opt_skip_test_list} if defined @{$opt_skip_test_list};
+ unshift (@disabled_collection, "$testdir/disabled.def");
+ for my $skip (@disabled_collection)
+ {
+ if ( open(DISABLED, $skip ) )
+ {
+ # $^O on Windows considered not generic enough
+ my $plat= (IS_WINDOWS) ? 'windows' : $^O;
+
+ while ( <DISABLED> )
+ {
+ chomp;
+ #diasble the test case if platform matches
+ if ( /\@/ )
+ {
+ if ( /\@$plat/ )
+ {
+ /^\s*(\S+)\s*\@$plat.*:\s*(.*?)\s*$/ ;
+ $disabled{$1}= $2 if not exists $disabled{$1};
+ }
+ elsif ( /\@!(\S*)/ )
+ {
+ if ( $1 ne $plat)
+ {
+ /^\s*(\S+)\s*\@!.*:\s*(.*?)\s*$/ ;
+ $disabled{$1}= $2 if not exists $disabled{$1};
+ }
+ }
+ }
+ elsif ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
+ {
+ chomp;
+ if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
+ {
+ $disabled{$1}= $2 if not exists $disabled{$1};
+ }
+ }
+ }
+ close DISABLED;
+ }
+ }
# Read suite.opt file
my $suite_opts= [ opts_from_file("$testdir/suite.opt") ];
$suite_opts = [ opts_from_file("$suitedir/suite.opt") ] unless @$suite_opts;
+ my @case_names;
+ {
+ my $s= $::suites{$suite};
+ $s = 'My::Suite' unless ref $s;
+ @case_names= $s->list_cases($testdir);
+ }
+
if ( @$opt_cases )
{
+ my (%case_names)= map { $_ => 1 } @case_names;
+ @case_names= ();
+
# Collect in specified order
foreach my $test_name_spec ( @$opt_cases )
{
- my ($sname, $tname, $extension)= split_testname($test_name_spec);
+ my ($sname, $tname)= split_testname($test_name_spec);
- # The test name parts have now been defined
- #print " suite_name: $sname\n";
- #print " tname: $tname\n";
- #print " extension: $extension\n";
-
- # Check cirrect suite if suitename is defined
+ # Check correct suite if suitename is defined
next if (defined $sname and $suite ne $sname);
- if ( defined $extension )
+ # Extension was specified, check if the test exists
+ if ( ! $case_names{$tname})
{
- my $full_name= "$testdir/$tname.$extension";
- # Extension was specified, check if the test exists
- if ( ! -f $full_name)
- {
- # This is only an error if suite was specified, otherwise it
- # could exist in another suite
- mtr_error("Test '$full_name' was not found in suite '$sname'")
- if $sname;
+ # This is only an error if suite was specified, otherwise it
+ # could exist in another suite
+ mtr_error("Test '$tname' was not found in suite '$sname'")
+ if $sname;
- next;
- }
+ next;
}
- else
- {
- # No extension was specified, use default
- $extension= "test";
- my $full_name= "$testdir/$tname.$extension";
-
- # Test not found here, could exist in other suite
- next if ( ! -f $full_name );
- }
-
- push(@cases,
- collect_one_test_case($suitedir,
- $testdir,
- $resdir,
- $suite,
- $tname,
- "$tname.$extension",
- \%disabled,
- $suite_opts));
+ push @case_names, $tname;
}
}
- else
+
+ foreach (@case_names)
{
- opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!");
+ # Skip tests that do not match the --do-test= filter
+ next if ($do_test_reg and not $_ =~ /$do_test_reg/o);
- foreach my $elem ( sort readdir(TESTDIR) )
- {
- my $tname= mtr_match_extension($elem, 'test');
-
- next unless defined $tname;
-
- # Skip tests that does not match the --do-test= filter
- next if ($do_test_reg and not $tname =~ /$do_test_reg/o);
-
- push(@cases,
- collect_one_test_case($suitedir,
- $testdir,
- $resdir,
- $suite,
- $tname,
- $elem,
- \%disabled,
- $suite_opts));
- }
- closedir TESTDIR;
+ push(@cases, collect_one_test_case($suitedir, $testdir, $resdir,
+ $suite, $_, "$_.test", \%disabled,
+ $suite_opts));
}
# Return empty list if no testcases found
@@ -622,6 +600,9 @@ sub optimize_cases {
my $default_engine=
mtr_match_prefix($opt, "--default-storage-engine=");
+ # Allow use of uppercase, convert to all lower case
+ $default_engine =~ tr/A-Z/a-z/;
+
if (defined $default_engine){
#print " $tinfo->{name}\n";
@@ -759,7 +740,7 @@ sub collect_one_test_case {
if ( $start_from && 0)
{
# start_from can be specified as [suite.].testname_prefix
- my ($suite, $test, $ext)= split_testname($start_from);
+ my ($suite, $test)= split_testname($start_from);
if ( $suite and $suitename lt $suite){
return; # Skip silently
@@ -1009,6 +990,17 @@ sub collect_one_test_case {
}
}
+ if ( $tinfo->{'need_ipv6'} )
+ {
+ # This is a test that needs ssl
+ if ( ! $::have_ipv6 ) {
+ # IPv6 is not supported, skip it
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "No IPv6";
+ return $tinfo;
+ }
+ }
+
# ----------------------------------------------------------------------
# Find config file to use if not already selected in <testname>.opt file
# ----------------------------------------------------------------------
@@ -1038,26 +1030,6 @@ sub collect_one_test_case {
$tinfo->{template_path}= $config;
}
- if ( $tinfo->{'example_plugin_test'} )
- {
- if ( !$ENV{'HA_EXAMPLE_SO'} )
- {
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Test requires the 'example' plugin";
- return $tinfo;
- }
- }
-
- if ( $tinfo->{'oqgraph_test'} )
- {
- if ( !$ENV{'GRAPH_ENGINE_SO'} )
- {
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Test requires the OQGraph storage engine";
- return $tinfo;
- }
- }
-
if (not ref $::suites{$tinfo->{suite}})
{
$tinfo->{'skip'}= 1;
@@ -1086,9 +1058,8 @@ my $tags_map= {'big_test' => ['big_test', 1],
'ndb_master-slave' => ['rpl_test', 1, 'ndb_test', 1],
'not_embedded' => ['not_embedded', 1],
'not_valgrind' => ['not_valgrind', 1],
- 'have_example_plugin' => ['example_plugin_test', 1],
- 'have_oqgraph_engine' => ['oqgraph_test', 1],
'have_ssl' => ['need_ssl', 1],
+ 'check_ipv6' => ['need_ipv6', 1],
'long_test' => ['long_test', 1],
};
my $tags_regex_string= join('|', keys %$tags_map);
@@ -1109,6 +1080,8 @@ my $file_to_slave_opts= { };
sub get_tags_from_file {
my ($file, $suitedir)= @_;
+ return ([], [], []) unless -f $file;
+
return ($file_to_tags->{$file}, $file_to_master_opts->{$file},
$file_to_slave_opts->{$file})
if exists($file_to_tags->{$file});
@@ -1207,7 +1180,7 @@ sub opts_from_file ($) {
{
chomp;
- # --set-variable=init_connect=set @a='a\\0c'
+ # --init_connect=set @a='a\\0c'
s/^\s+//; # Remove leading space
s/\s+$//; # Remove ending space
@@ -1256,3 +1229,4 @@ sub print_testcases {
1;
+
diff --git a/mysql-test/lib/mtr_gcov.pl b/mysql-test/lib/mtr_gcov.pl
index 3bdfb9857e2..a6e1f8efd5f 100644
--- a/mysql-test/lib/mtr_gcov.pl
+++ b/mysql-test/lib/mtr_gcov.pl
@@ -1,6 +1,5 @@
# -*- cperl -*-
-# Copyright (c) 2004, 2006, 2008 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# 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
@@ -34,7 +33,7 @@ sub gcov_prepare ($) {
#
# Collect gcov statistics.
# Arguments:
-# $dir basedir, normally source directory
+# $dir basedir, normally build directory
# $gcov gcov utility program [path] name
# $gcov_msg message file name
# $gcov_err error file name
@@ -46,31 +45,26 @@ sub gcov_collect ($$$) {
my $start_dir= cwd();
print "Collecting source coverage info using '$gcov'...$basedir\n";
- -f "$start_dir/$gcov_msg" and unlink("$start_dir/$gcov_msg");
- -f "$start_dir/$gcov_err" and unlink("$start_dir/$gcov_err");
+ -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 ) {
- my $dir_reported= 0;
chomp($d);
chdir($d) or next;
- foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) ) {
- $f =~ /(.*)\.[ch]c?/;
- -f "$1.gcno" or next;
- if (!$dir_reported) {
- print "Collecting in '$d'...\n";
- $dir_reported= 1;
- }
- system("$gcov $f 2>>$start_dir/$gcov_err >>$start_dir/$gcov_msg");
- system("perl", "$basedir/mysql-test/lib/process-purecov-annotations.pl", "$f.gcov");
+ 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 $gcov_msg, errors in $gcov_err\n";
+ print "gcov info in $dir/$gcov_msg, errors in $dir/$gcov_err\n";
}
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index b84eec563b2..0377047c4eb 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -1,5 +1,5 @@
# -*- cperl -*-
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates.
# Copyright (c) 2009-2011, Monty Program Ab
#
# This program is free software; you can redistribute it and/or
@@ -32,9 +32,18 @@ sub mtr_script_exists(@);
sub mtr_file_exists(@);
sub mtr_exe_exists(@);
sub mtr_exe_maybe_exists(@);
+sub mtr_compress_file($);
sub mtr_milli_sleep($);
sub start_timer($);
sub has_expired($);
+sub init_timers();
+sub mark_time_used($);
+sub mark_time_idle();
+sub add_total_times($);
+sub print_times_used($$);
+sub print_total_times($);
+
+our $opt_report_times;
##############################################################################
#
@@ -192,6 +201,40 @@ sub mtr_exe_exists (@) {
}
}
+#
+# Try to compress file using tools that might be available.
+# If zip/gzip is not available, just silently ignore.
+#
+
+sub mtr_compress_file ($) {
+ my ($filename)= @_;
+
+ mtr_error ("File to compress not found: $filename") unless -f $filename;
+
+ my $did_compress= 0;
+
+ if (IS_WINDOWS)
+ {
+ # Capture stderr
+ my $ziperr= `zip $filename.zip $filename 2>&1`;
+ if ($?) {
+ print "$ziperr\n" if $ziperr !~ /recognized as an internal or external/;
+ } else {
+ unlink($filename);
+ $did_compress=1;
+ }
+ }
+ else
+ {
+ my $gzres= system("gzip $filename");
+ $did_compress= ! $gzres;
+ if ($gzres && $gzres != -1) {
+ mtr_error ("Error: have gzip but it fails to compress core file");
+ }
+ }
+ mtr_print("Compressed file $filename") if $did_compress;
+}
+
sub mtr_milli_sleep ($) {
die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1;
@@ -227,4 +270,87 @@ sub start_timer ($) { return time + $_[0]; }
sub has_expired ($) { return $_[0] && time gt $_[0]; }
+# Below code is for time usage reporting
+
+use Time::HiRes qw(gettimeofday);
+
+my %time_used= (
+ 'collect' => 0,
+ 'restart' => 0,
+ 'check' => 0,
+ 'ch-warn' => 0,
+ 'test' => 0,
+ 'init' => 0,
+ 'admin' => 0,
+);
+
+my %time_text= (
+ 'collect' => "Collecting test cases",
+ 'restart' => "Server stop/start",
+ 'check' => "Check-testcase",
+ 'ch-warn' => "Check for warnings",
+ 'test' => "Test execution",
+ 'init' => "Initialization/cleanup",
+ 'admin' => "Test administration",
+);
+
+# Counts number of reports from workers
+
+my $time_totals= 0;
+
+my $last_timer_set;
+
+sub init_timers() {
+ $last_timer_set= gettimeofday();
+}
+
+sub mark_time_used($) {
+ my ($name)= @_;
+ return unless $opt_report_times;
+ die "Unknown timer $name" unless exists $time_used{$name};
+
+ my $curr_time= gettimeofday();
+ $time_used{$name}+= int (($curr_time - $last_timer_set) * 1000 + .5);
+ $last_timer_set= $curr_time;
+}
+
+sub mark_time_idle() {
+ $last_timer_set= gettimeofday() if $opt_report_times;
+}
+
+sub add_total_times($) {
+ my ($dummy, $num, @line)= split (" ", $_[0]);
+
+ $time_totals++;
+ foreach my $elem (@line) {
+ my ($name, $spent)= split (":", $elem);
+ $time_used{$name}+= $spent;
+ }
+}
+
+sub print_times_used($$) {
+ my ($server, $num)= @_;
+ return unless $opt_report_times;
+
+ my $output= "SPENT $num";
+ foreach my $name (keys %time_used) {
+ my $spent= $time_used{$name};
+ $output.= " $name:$spent";
+ }
+ print $server $output . "\n";
+}
+
+sub print_total_times($) {
+ # Don't print if we haven't received all worker data
+ return if $time_totals != $_[0];
+
+ foreach my $name (keys %time_used)
+ {
+ my $spent= $time_used{$name}/1000;
+ my $text= $time_text{$name};
+ print ("Spent $spent seconds on $text\n");
+ }
+}
+
+
1;
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index b669612f858..4bb6be711f0 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -40,7 +40,7 @@ BEGIN
eval 'sub USE_NETPING { $use_netping }';
}
-sub sleep_until_file_created ($$$);
+sub sleep_until_file_created ($$$$);
sub mtr_ping_port ($);
sub mtr_ping_port ($) {
@@ -102,10 +102,11 @@ sub mtr_ping_port ($) {
# FIXME check that the pidfile contains the expected pid!
-sub sleep_until_file_created ($$$) {
+sub sleep_until_file_created ($$$$) {
my $pidfile= shift;
my $timeout= shift;
my $proc= shift;
+ my $warn_seconds = shift;
my $sleeptime= 100; # Milliseconds
my $loops= ($timeout * 1000) / $sleeptime;
@@ -116,18 +117,20 @@ sub sleep_until_file_created ($$$) {
return 1;
}
+ my $seconds= ($loop * $sleeptime) / 1000;
+
# Check if it died after the fork() was successful
if ( defined $proc and ! $proc->wait_one(0) )
{
- mtr_warning("Process $proc died");
+ mtr_warning("Process $proc died after mysql-test-run waited $seconds " .
+ "seconds for $pidfile to be created.");
return 0;
}
mtr_debug("Sleep $sleeptime milliseconds waiting for $pidfile");
- # Print extra message every 60 seconds
- my $seconds= ($loop * $sleeptime) / 1000;
- if ( $seconds > 1 and int($seconds * 10) % 600 == 0 )
+ # Print extra message every $warn_seconds seconds
+ if ( $seconds > 1 && ($seconds*10) % ($warn_seconds*10) == 0 && $seconds < $timeout )
{
my $left= $timeout - $seconds;
mtr_warning("Waited $seconds seconds for $pidfile to be created, " .
@@ -138,6 +141,8 @@ sub sleep_until_file_created ($$$) {
}
+ mtr_warning("Timeout after mysql-test-run waited $timeout seconds " .
+ "for the process $proc to create a pid file.");
return 0;
}
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
index e8979fca5fb..e68ac783369 100644
--- a/mysql-test/lib/mtr_report.pm
+++ b/mysql-test/lib/mtr_report.pm
@@ -35,6 +35,7 @@ use My::Platform;
use POSIX qw[ _exit ];
use IO::Handle qw[ flush ];
require "mtr_io.pl";
+use mtr_results;
my $tot_real_time= 0;
@@ -70,7 +71,7 @@ sub _mtr_report_test_name ($) {
print _name(). _timestamp();
printf "%-40s ", $tname;
my $worker = $tinfo->{worker};
- printf "w$worker " if $worker;
+ print "w$worker " if defined $worker;
return $tname;
}
@@ -93,6 +94,7 @@ sub mtr_report_test_passed ($) {
{
$timer_str= mtr_fromfile("$::opt_vardir/log/timer");
$tinfo->{timer}= $timer_str;
+ resfile_test_info('duration', $timer_str) if $::opt_resfile;
}
# Big warning if status already set
@@ -231,7 +233,8 @@ sub mtr_report_stats ($$$$) {
# Find out how we where doing
# ----------------------------------------------------------------------
- my $tot_skiped= 0;
+ my $tot_skipped= 0;
+ my $tot_skipdetect= 0;
my $tot_passed= 0;
my $tot_failed= 0;
my $tot_tests= 0;
@@ -248,8 +251,9 @@ sub mtr_report_stats ($$$$) {
}
elsif ( $tinfo->{'result'} eq 'MTR_RES_SKIPPED' )
{
- # Test was skipped
- $tot_skiped++;
+ # Test was skipped (disabled not counted)
+ $tot_skipped++ unless $tinfo->{'disable'};
+ $tot_skipdetect++ if $tinfo->{'skip_detected_by_test'};
}
elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' )
{
@@ -299,6 +303,8 @@ sub mtr_report_stats ($$$$) {
time - $BASETIME, "seconds executing testcases");
}
+ resfile_global("duration", time - $BASETIME) if $::opt_resfile;
+
my $warnlog= "$::opt_vardir/log/warnings";
if ( ! $::glob_use_running_server && !$::opt_extern && -f $warnlog)
{
@@ -385,6 +391,9 @@ MSG
print " $_\n" for @$extra_warnings;
}
+ print "$tot_skipped tests were skipped, ".
+ "$tot_skipdetect by the test itself.\n\n" if $tot_skipped;
+
if ( $tot_failed != 0 || $found_problems)
{
mtr_error("there were failing test cases");
@@ -407,7 +416,7 @@ MSG
##############################################################################
sub mtr_print_line () {
- print '-' x 60 . "\n";
+ print '-' x 74 . "\n";
}
@@ -417,13 +426,18 @@ sub mtr_print_thick_line {
}
-sub mtr_print_header () {
+sub mtr_print_header ($) {
+ my ($wid) = @_;
print "\n";
printf "TEST";
- print " " x 38;
+ if ($wid) {
+ print " " x 34 . "WORKER ";
+ } else {
+ print " " x 38;
+ }
print "RESULT ";
- print "TIME (ms)" if $timer;
- print "\n";
+ print "TIME (ms) or " if $timer;
+ print "COMMENT\n";
mtr_print_line();
print "\n";
}
diff --git a/mysql-test/lib/mtr_results.pm b/mysql-test/lib/mtr_results.pm
new file mode 100644
index 00000000000..92b03756c04
--- /dev/null
+++ b/mysql-test/lib/mtr_results.pm
@@ -0,0 +1,167 @@
+# -*- cperl -*-
+# Copyright (c) 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-1301 USA
+
+package mtr_results;
+use strict;
+use IO::Handle qw[ flush ];
+
+use base qw(Exporter);
+our @EXPORT= qw(resfile_init resfile_global resfile_new_test resfile_test_info
+ resfile_output resfile_output_file resfile_print
+ resfile_print_test resfile_to_test resfile_from_test );
+
+my %curr_result; # Result for current test
+my $curr_output; # Output for current test
+my $do_resfile;
+
+END {
+ close RESF if $do_resfile;
+}
+
+sub resfile_init($)
+{
+ my $fname= shift;
+ open (RESF, " > $fname") or die ("Could not open result file $fname");
+ %curr_result= ();
+ $curr_output= "";
+ $do_resfile= 1;
+}
+
+# Strings need to be quoted if they start with white space or ",
+# or if they contain newlines. Pass a reference to the string.
+# If the string is quoted, " must be escaped, thus \ also must be escaped
+
+sub quote_value($)
+{
+ my $stref= shift;
+
+ for ($$stref) {
+ return unless /^[\s"]/ or /\n/;
+ s/\\/\\\\/g;
+ s/"/\\"/g;
+ $_= '"' . $_ . '"';
+ }
+}
+
+# Output global variable setting to result file.
+
+sub resfile_global($$)
+{
+ return unless $do_resfile;
+ my ($tag, $val) = @_;
+ $val= join (' ', @$val) if ref($val) eq 'ARRAY';
+ quote_value(\$val);
+ print RESF "$tag : $val\n";
+}
+
+# Prepare to add results for new test
+
+sub resfile_new_test()
+{
+ %curr_result= ();
+ $curr_output= "";
+}
+
+# Add (or change) one variable setting for current test
+
+sub resfile_test_info($$)
+{
+ my ($tag, $val) = @_;
+ return unless $do_resfile;
+ quote_value(\$val);
+ $curr_result{$tag} = $val;
+}
+
+# Add to output value for current test.
+# Will be quoted if necessary, truncated if length over 5000.
+
+sub resfile_output($)
+{
+ return unless $do_resfile;
+
+ for (shift) {
+ my $len= length;
+ if ($len > 5000) {
+ my $trlen= $len - 5000;
+ $_= substr($_, 0, 5000) . "\n[TRUNCATED $trlen chars removed]\n";
+ }
+ s/\\/\\\\/g;
+ s/"/\\"/g;
+ $curr_output .= $_;
+ }
+}
+
+# Add to output, read from named file
+
+sub resfile_output_file($)
+{
+ resfile_output(::mtr_grab_file(shift)) if $do_resfile;
+}
+
+# Print text, and also append to current output if we're collecting results
+
+sub resfile_print($)
+{
+ my $txt= shift;
+ print($txt);
+ resfile_output($txt) if $do_resfile;
+}
+
+# Print results for current test, then reset
+# (So calling a second time without having generated new results
+# will have no effect)
+
+sub resfile_print_test()
+{
+ return unless %curr_result;
+
+ print RESF "{\n";
+ while (my ($t, $v) = each %curr_result) {
+ print RESF "$t : $v\n";
+ }
+ if ($curr_output) {
+ chomp($curr_output);
+ print RESF " output : " . $curr_output . "\"\n";
+ }
+ print RESF "}\n";
+ IO::Handle::flush(\*RESF);
+ resfile_new_test();
+}
+
+# Add current test results to test object (to send from worker)
+
+sub resfile_to_test($)
+{
+ return unless $do_resfile;
+ my $tinfo= shift;
+ my @res_array= %curr_result;
+ $tinfo->{'resfile'}= \@res_array;
+ $tinfo->{'output'}= $curr_output if $curr_output;
+}
+
+# Get test results (from worker) from test object
+
+sub resfile_from_test($)
+{
+ return unless $do_resfile;
+ my $tinfo= shift;
+ my $res_array= $tinfo->{'resfile'};
+ return unless $res_array;
+ %curr_result= @$res_array;
+ $curr_output= $tinfo->{'output'} if defined $tinfo->{'output'};
+}
+
+1;
diff --git a/mysql-test/lib/t/Options.t b/mysql-test/lib/t/Options.t
index 1ae1bc5f28b..c832b885cb7 100644
--- a/mysql-test/lib/t/Options.t
+++ b/mysql-test/lib/t/Options.t
@@ -1,7 +1,6 @@
# -*- cperl -*-
-# Copyright (c) 2008 MySQL AB
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, 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
@@ -61,42 +60,30 @@ my @tests=
[
[ ],
- ['-O', 'max_binlog_size=1' ],
['--max_binlog_size=1' ]
],
[
- ['-O', 'max_binlog_size=1' ],
- ['-O', 'max_binlog_size=1' ],
- [ ],
- ],
-
- [
- ['-O', 'max_binlog_size=1' ],
[ ],
['--max_binlog_size=default' ]
],
[
[ ],
- ['-O', 'max_binlog_size=1', '--binlog-format=row' ],
['--max_binlog_size=1', '--binlog-format=row' ]
],
[
['--binlog-format=statement' ],
- ['-O', 'max_binlog_size=1', '--binlog-format=row' ],
['--max_binlog_size=1', '--binlog-format=row']
],
[
[ '--binlog-format=statement' ],
- ['-O', 'max_binlog_size=1', '--binlog-format=statement' ],
['--max_binlog_size=1' ]
],
[
[ '--binlog-format=statement' ],
- ['-O', 'max_binlog_size=1', '--binlog-format=statement' ],
['--max_binlog_size=1' ]
],
@@ -109,7 +96,7 @@ my @tests=
[
[ '--binlog-format=statement' ],
- ['--relay-log=/path/to/a/relay-log', '-O', 'max_binlog_size=1'],
+ ['--relay-log=/path/to/a/relay-log', '--max_binlog_size=1'],
['--max_binlog_size=1', '--relay-log=/path/to/a/relay-log', '--binlog-format=default' ]
],
diff --git a/mysql-test/lib/t/testMyConfigFactory.t b/mysql-test/lib/t/testMyConfigFactory.t
index d3f3c9b67df..9f43bed3d98 100755
--- a/mysql-test/lib/t/testMyConfigFactory.t
+++ b/mysql-test/lib/t/testMyConfigFactory.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# -*- cperl -*-
-# Copyright (c) 2007 MySQL AB
+# Copyright (c) 2007 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
# This program is free software; you can redistribute it and/or modify
@@ -83,11 +83,11 @@ is( $config->value('client', 'host'),
ok ( $config->value("mysqld.1", 'character-sets-dir') =~ /$basedir.*charsets$/,
"'character-sets-dir' generated");
-ok ( $config->value("mysqld.1", 'language') =~ /$basedir.*english$/,
- "'language' generated");
+ok ( $config->value("mysqld.1", 'lc-messages-dir') =~ /$basedir.*share$/,
+ "'lc-messages-dir' generated");
ok ( $config->value("ENV", 'MASTER_MY_PORT') =~ /\d/,
- "'language' generated");
+ "'lc-messages-dir' generated");
my $gen2_cnf= "$dir/gen2.cnf";
open(OUT, ">", $gen2_cnf) or die;
diff --git a/mysql-test/lib/v1/mtr_io.pl b/mysql-test/lib/v1/mtr_io.pl
index ebd50ad2212..5769240bf7f 100644
--- a/mysql-test/lib/v1/mtr_io.pl
+++ b/mysql-test/lib/v1/mtr_io.pl
@@ -1,6 +1,5 @@
# -*- cperl -*-
-# Copyright (c) 2004-2006 MySQL AB, 2008 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2004, 2010, 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
@@ -81,7 +80,7 @@ sub mtr_get_opts_from_file ($) {
{
chomp;
- # --set-variable=init_connect=set @a='a\\0c'
+ # --init_connect=set @a='a\\0c'
s/^\s+//; # Remove leading space
s/\s+$//; # Remove ending space
diff --git a/mysql-test/lib/v1/mtr_misc.pl b/mysql-test/lib/v1/mtr_misc.pl
index 39d27a33248..07b50e865ab 100644
--- a/mysql-test/lib/v1/mtr_misc.pl
+++ b/mysql-test/lib/v1/mtr_misc.pl
@@ -1,6 +1,5 @@
# -*- cperl -*-
-# Copyright (c) 2004-2006 MySQL AB, 2008 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2004, 2010, 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
@@ -142,7 +141,6 @@ sub mtr_exe_maybe_exists (@) {
my @path= @_;
map {$_.= ".exe"} @path if $::glob_win32;
- map {$_.= ".nlm"} @path if $::glob_netware;
foreach my $path ( @path )
{
if($::glob_win32)
diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl
index 51527dc9d20..7166eb523f2 100644
--- a/mysql-test/lib/v1/mtr_report.pl
+++ b/mysql-test/lib/v1/mtr_report.pl
@@ -1,6 +1,5 @@
# -*- cperl -*-
-# Copyright (c) 2004-2006 MySQL AB, 2008 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2004, 2010, 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
@@ -254,19 +253,8 @@ sub mtr_report_stats ($) {
mtr_warning("can't read $errlog");
next;
}
- my $leak_reports_expected= undef;
while ( <ERR> )
{
- # There is a test case that purposely provokes a
- # SAFEMALLOC leak report, even though there is no actual
- # leak. We need to detect this, and ignore the warning in
- # that case.
- if (/Begin safemalloc memory dump:/) {
- $leak_reports_expected= 1;
- } elsif (/End safemalloc memory dump./) {
- $leak_reports_expected= undef;
- }
-
# Skip some non fatal warnings from the log files
if (
/\"SELECT UNIX_TIMESTAMP\(\)\" failed on master/ or
@@ -377,19 +365,22 @@ sub mtr_report_stats ($) {
/Slave: Can't DROP 'c7'.* 1091/ or
/Slave: Key column 'c6'.* 1072/ or
- # 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/
- )) or
-
- # These tests does "kill" on queries, causing sporadic errors when writing to logs
- (($testname eq 'rpl.rpl_skip_error' or
- $testname eq 'rpl.rpl_err_ignoredtable' or
- $testname eq 'binlog.binlog_killed_simulate' or
- $testname eq 'binlog.binlog_killed') and
- (/Failed to write to mysql\.\w+_log/
- )) 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_code: 1032/ or
+ /Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452/
+ )) or
+
+ # These tests does "kill" on queries, causing sporadic errors when writing to logs
+ (($testname eq 'rpl.rpl_skip_error' or
+ $testname eq 'rpl.rpl_err_ignoredtable' or
+ $testname eq 'binlog.binlog_killed_simulate' or
+ $testname eq 'binlog.binlog_killed') and
+ (/Failed to write to mysql\.\w+_log/
+ )) or
# rpl_bug33931 has deliberate failures
($testname eq 'rpl.rpl_bug33931' and
@@ -433,9 +424,6 @@ sub mtr_report_stats ($) {
}
if ( /$pattern/ )
{
- if ($leak_reports_expected) {
- next;
- }
$found_problems= 1;
print WARN basename($errlog) . ": $testname: $_";
}
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index 40d92cdb676..f20eab80ae9 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -1,8 +1,7 @@
#!/usr/bin/perl
# -*- cperl -*-
-# Copyright (c) 2008, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, 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
@@ -91,7 +90,6 @@ $| = 1; # Automatically flush STDOUT
our $glob_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl
our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl
our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl);
-our $glob_netware= ($^O eq "NetWare"); # NetWare
require "lib/v1/mtr_cases.pl";
require "lib/v1/mtr_im.pl";
@@ -124,6 +122,7 @@ our $glob_use_embedded_server= 0;
our @glob_test_mode;
our $glob_basedir;
+our $glob_bindir;
our $path_charsetsdir;
our $path_client_bindir;
@@ -151,7 +150,7 @@ our $default_vardir;
our $opt_usage;
our $opt_list_options;
our $opt_suites;
-our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb,maria"; # Default suites to run
+our $opt_suites_default= "main,binlog,rpl,maria"; # Default suites to run
our $opt_script_debug= 0; # Script debugging, enable with --script-debug
our $opt_verbose= 0; # Verbose output, enable with --verbose
@@ -168,13 +167,11 @@ our $exe_mysqldump;
our $exe_mysqlslap;
our $exe_mysqlimport;
our $exe_mysqlshow;
-our $exe_mysql_fix_system_tables;
our $file_mysql_fix_privilege_tables;
our $exe_mysqltest;
our $exe_ndbd;
our $exe_ndb_mgmd;
our $exe_slave_mysqld;
-our $exe_im;
our $exe_my_print_defaults;
our $exe_perror;
our $lib_udf_example;
@@ -751,13 +748,21 @@ sub command_line_setup () {
$glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
chomp($glob_mysql_test_dir);
}
- $default_vardir= "$glob_mysql_test_dir/var";
+ if (defined $ENV{MTR_BINDIR})
+ {
+ $default_vardir= "$ENV{MTR_BINDIR}/mysql-test/var";
+ }
+ else
+ {
+ $default_vardir= "$glob_mysql_test_dir/var";
+ }
# In most cases, the base directory we find everything relative to,
# is the parent directory of the "mysql-test" directory. For source
# distributions, TAR binary distributions and some other packages.
$glob_basedir= dirname($glob_mysql_test_dir);
+ $glob_bindir= $ENV{'MTR_BINDIR'} || $glob_basedir;
# In the RPM case, binaries and libraries are installed in the
# default system locations, instead of having our own private base
# directory. And we install "/usr/share/mysql-test". Moving up one
@@ -823,36 +828,37 @@ sub command_line_setup () {
}
else
{
- $path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
- "$glob_basedir/client_debug",
+ $path_client_bindir= mtr_path_exists("$glob_bindir/client_release",
+ "$glob_bindir/client_debug",
vs_config_dirs('client', ''),
- "$glob_basedir/client",
- "$glob_basedir/bin");
+ "$glob_bindir/client",
+ "$glob_bindir/bin");
}
# Look for language files and charsetsdir, use same share
- $path_share= mtr_path_exists("$glob_basedir/share/mysql",
- "$glob_basedir/sql/share",
- "$glob_basedir/share");
-
- $path_language= mtr_path_exists("$path_share/english");
- $path_charsetsdir= mtr_path_exists("$path_share/charsets");
+ $path_share= mtr_path_exists("$glob_bindir/share/mysql",
+ "$glob_bindir/sql/share",
+ "$glob_bindir/share");
+ $path_language= mtr_path_exists("$path_share");
+ $path_charsetsdir = mtr_path_exists("$glob_basedir/share/mysql/charsets",
+ "$glob_basedir/sql/share/charsets",
+ "$glob_basedir/share/charsets");
if (!$opt_extern)
{
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
vs_config_dirs('sql', 'mysqld-debug'),
- "$glob_basedir/sql/mysqld",
+ "$glob_bindir/sql/mysqld",
"$path_client_bindir/mysqld-max-nt",
"$path_client_bindir/mysqld-max",
"$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-debug",
"$path_client_bindir/mysqld-max",
- "$glob_basedir/libexec/mysqld",
- "$glob_basedir/bin/mysqld",
- "$glob_basedir/sbin/mysqld");
+ "$glob_bindir/libexec/mysqld",
+ "$glob_bindir/bin/mysqld",
+ "$glob_bindir/sbin/mysqld");
# Use the mysqld found above to find out what features are available
collect_mysqld_features();
@@ -1485,7 +1491,7 @@ sub collect_mysqld_features () {
#
# --datadir must exist, mysqld will chdir into it
#
- my $list= `$exe_mysqld --no-defaults --datadir=$tmpdir --language=$path_language --skip-grant-tables --verbose --help`;
+ my $list= `$exe_mysqld --no-defaults --datadir=$tmpdir --lc-messages-dir=$path_language --skip-grant-tables --verbose --help`;
foreach my $line (split('\n', $list))
{
@@ -1581,37 +1587,24 @@ sub collect_mysqld_features_from_running_server ()
}
}
-sub executable_setup_im () {
-
- # Look for instance manager binary - mysqlmanager
- $exe_im=
- mtr_exe_maybe_exists(
- "$glob_basedir/server-tools/instance-manager/mysqlmanager",
- "$glob_basedir/libexec/mysqlmanager",
- "$glob_basedir/bin/mysqlmanager",
- "$glob_basedir/sbin/mysqlmanager");
-
- return ($exe_im eq "");
-}
-
sub executable_setup_ndb () {
# Look for ndb tols and binaries
- my $ndb_path= mtr_file_exists("$glob_basedir/ndb",
- "$glob_basedir/storage/ndb",
- "$glob_basedir/bin");
+ my $ndb_path= mtr_file_exists("$glob_bindir/ndb",
+ "$glob_bindir/storage/ndb",
+ "$glob_bindir/bin");
$exe_ndbd=
mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd",
"$ndb_path/ndbd",
- "$glob_basedir/libexec/ndbd");
+ "$glob_bindir/libexec/ndbd");
$exe_ndb_mgm=
mtr_exe_maybe_exists("$ndb_path/src/mgmclient/ndb_mgm",
"$ndb_path/ndb_mgm");
$exe_ndb_mgmd=
mtr_exe_maybe_exists("$ndb_path/src/mgmsrv/ndb_mgmd",
"$ndb_path/ndb_mgmd",
- "$glob_basedir/libexec/ndb_mgmd");
+ "$glob_bindir/libexec/ndb_mgmd");
$exe_ndb_waiter=
mtr_exe_maybe_exists("$ndb_path/tools/ndb_waiter",
"$ndb_path/ndb_waiter");
@@ -1654,11 +1647,11 @@ sub executable_setup () {
$exe_my_print_defaults=
mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
"$path_client_bindir/my_print_defaults",
- "$glob_basedir/extra/my_print_defaults");
+ "$glob_bindir/extra/my_print_defaults");
# Look for perror
$exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'),
- "$glob_basedir/extra/perror",
+ "$glob_bindir/extra/perror",
"$path_client_bindir/perror");
# Look for the client binaries
@@ -1697,14 +1690,6 @@ sub executable_setup () {
$exe_mysql_upgrade= "";
}
- if ( ! $glob_win32 )
- {
- # Look for mysql_fix_system_table script
- $exe_mysql_fix_system_tables=
- mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
- "$path_client_bindir/mysql_fix_privilege_tables");
- }
-
# Look for mysql_fix_privilege_tables.sql script
$file_mysql_fix_privilege_tables=
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
@@ -1723,23 +1708,15 @@ sub executable_setup () {
}
}
- if ( ! $opt_skip_im and executable_setup_im())
- {
- mtr_warning("Could not find all required instance manager binaries, " .
- "all im tests will fail, use --skip-im to " .
- "continue without instance manager");
- $instance_manager->{"executable_setup_failed"}= 1;
- }
-
# Look for the udf_example library
$lib_udf_example=
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
- "$glob_basedir/sql/.libs/udf_example.so",);
+ "$glob_bindir/sql/.libs/udf_example.so",);
# Look for the ha_example library
$lib_example_plugin=
mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
- "$glob_basedir/storage/example/.libs/ha_example.so",);
+ "$glob_bindir/storage/example/.libs/ha_example.so",);
}
@@ -1748,7 +1725,7 @@ sub executable_setup () {
{
$exe_mysqltest=
mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'),
- "$glob_basedir/libmysqld/examples/mysqltest_embedded",
+ "$glob_bindir/libmysqld/examples/mysqltest_embedded",
"$path_client_bindir/mysqltest_embedded");
}
else
@@ -1763,21 +1740,21 @@ sub executable_setup () {
$exe_mysql_client_test=
mtr_exe_maybe_exists(
vs_config_dirs('libmysqld/examples', 'mysql_client_test_embedded'),
- "$glob_basedir/libmysqld/examples/mysql_client_test_embedded");
+ "$glob_bindir/libmysqld/examples/mysql_client_test_embedded");
}
else
{
$exe_mysql_client_test=
mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
- "$glob_basedir/tests/mysql_client_test",
- "$glob_basedir/bin/mysql_client_test");
+ "$glob_bindir/tests/mysql_client_test",
+ "$glob_bindir/bin/mysql_client_test");
}
# Look for bug25714 executable which may _not_ exist in
# some versions, test using it should be skipped
$exe_bug25714=
mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
- "$glob_basedir/tests/bug25714");
+ "$glob_bindir/tests/bug25714");
}
@@ -1829,7 +1806,7 @@ sub mysql_client_test_arguments()
if ( $glob_use_embedded_server )
{
mtr_add_arg($args,
- " -A --language=$path_language");
+ " -A --lc-messages-dir=$path_language");
mtr_add_arg($args,
" -A --datadir=$slave->[0]->{'path_myddir'}");
mtr_add_arg($args,
@@ -1886,13 +1863,13 @@ sub environment_setup () {
# are used in favor of the system installed ones
if ( $source_dist )
{
- push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
- "$glob_basedir/libmysql_r/.libs/",
- "$glob_basedir/zlib.libs/");
+ push(@ld_library_paths, "$glob_bindir/libmysql/.libs/",
+ "$glob_bindir/libmysql_r/.libs/",
+ "$glob_bindir/zlib.libs/");
}
else
{
- push(@ld_library_paths, "$glob_basedir/lib");
+ push(@ld_library_paths, "$glob_bindir/lib");
}
}
@@ -1901,7 +1878,7 @@ sub environment_setup () {
# --------------------------------------------------------------------------
if ( $glob_ndbcluster_supported )
{
- push(@ld_library_paths, "$glob_basedir/storage/ndb/src/.libs");
+ push(@ld_library_paths, "$glob_bindir/storage/ndb/src/.libs");
}
# --------------------------------------------------------------------------
@@ -2019,7 +1996,6 @@ sub environment_setup () {
# ----------------------------------------------------
if ( ! $opt_skip_im )
{
- $ENV{'IM_EXE'}= $exe_im;
$ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
$ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid};
$ENV{'IM_PORT'}= $instance_manager->{port};
@@ -2176,20 +2152,6 @@ sub environment_setup () {
$ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
}
- # ----------------------------------------------------
- # Setup env so childs can execute mysql_fix_system_tables
- # ----------------------------------------------------
- if ( !$opt_extern && ! $glob_win32 )
- {
- my $cmdline_mysql_fix_system_tables=
- "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
- "--user=root --password= " .
- "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'}";
- $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
-
- }
if ( !$opt_extern )
{
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
@@ -2233,14 +2195,14 @@ sub environment_setup () {
vs_config_dirs('storage/myisam', 'myisamchk'),
vs_config_dirs('myisam', 'myisamchk'),
"$path_client_bindir/myisamchk",
- "$glob_basedir/storage/myisam/myisamchk",
- "$glob_basedir/myisam/myisamchk"));
+ "$glob_bindir/storage/myisam/myisamchk",
+ "$glob_bindir/myisam/myisamchk"));
$ENV{'MYISAMPACK'}= mtr_native_path(mtr_exe_exists(
vs_config_dirs('storage/myisam', 'myisampack'),
vs_config_dirs('myisam', 'myisampack'),
"$path_client_bindir/myisampack",
- "$glob_basedir/storage/myisam/myisampack",
- "$glob_basedir/myisam/myisampack"));
+ "$glob_bindir/storage/myisam/myisampack",
+ "$glob_bindir/myisam/myisampack"));
# ----------------------------------------------------
# Setup env so childs can execute aria_pack and aria_chk
@@ -2632,12 +2594,12 @@ sub vs_config_dirs ($$) {
if ($opt_vs_config)
{
- return ("$glob_basedir/$path_part/$opt_vs_config/$exe");
+ return ("$glob_bindir/$path_part/$opt_vs_config/$exe");
}
- return ("$glob_basedir/$path_part/release/$exe",
- "$glob_basedir/$path_part/relwithdebinfo/$exe",
- "$glob_basedir/$path_part/debug/$exe");
+ return ("$glob_bindir/$path_part/release/$exe",
+ "$glob_bindir/$path_part/relwithdebinfo/$exe",
+ "$glob_bindir/$path_part/debug/$exe");
}
##############################################################################
@@ -3211,7 +3173,6 @@ sub install_db ($$) {
mtr_add_arg($args, "--bootstrap");
mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
mtr_add_arg($args, "--datadir=%s", $data_dir);
- mtr_add_arg($args, "--loose-skip-innodb");
mtr_add_arg($args, "--loose-skip-ndbcluster");
mtr_add_arg($args, "--loose-skip-aria");
mtr_add_arg($args, "--disable-sync-frm");
@@ -3231,10 +3192,16 @@ sub install_db ($$) {
$path_vardir_trace, $type);
}
- if ( ! $glob_netware )
- {
- mtr_add_arg($args, "--language=%s", $path_language);
- mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
+ mtr_add_arg($args, "--lc-messages-dir=%s", $path_language);
+ mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
+
+ # InnoDB arguments that affect file location and sizes may
+ # need to be given to the bootstrap process as well as the
+ # server process.
+ foreach my $extra_opt ( @opt_extra_mysqld_opt ) {
+ if ($extra_opt =~ /--innodb/) {
+ mtr_add_arg($args, $extra_opt);
+ }
}
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
@@ -3359,12 +3326,10 @@ socket = $instance->{path_sock}
pid-file = $instance->{path_pid}
port = $instance->{port}
datadir = $instance->{path_datadir}
-general-log-file = $instance->{path_datadir}/mysqld$server_id.log
-general-log = 1
+lc-messages-dir = $path_language
+log = $instance->{path_datadir}/mysqld$server_id.log
log-error = $instance->{path_datadir}/mysqld$server_id.err.log
-slow-query-log-file = $instance->{path_datadir}/mysqld$server_id.slow.log
-slow-query-log = 1
-language = $path_language
+log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log
character-sets-dir = $path_charsetsdir
basedir = $path_my_basedir
server_id = $server_id
@@ -3699,7 +3664,7 @@ sub run_testcase ($) {
{
mtr_timer_stop_all($glob_timers);
mtr_report("\nServers started, exiting");
- if ($glob_win32_perl)
+ if ($glob_win32_perl)
{
#ActiveState perl hangs when using normal exit, use POSIX::_exit instead
use POSIX qw[ _exit ];
@@ -3978,21 +3943,19 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
- if (!$opt_extern)
+ if ( $mysql_version_id >= 50036)
{
- if ( $mysql_version_id >= 50036)
- {
- # Prevent the started mysqld to access files outside of vardir
- mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
- }
+ # By default, prevent the started mysqld to access files outside of vardir
+ mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
+ }
- if ( $mysql_version_id >= 50000 ) {
- mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
- }
+ if ( $mysql_version_id >= 50000 )
+ {
+ mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
}
mtr_add_arg($args, "%s--character-set-server=latin1", $prefix);
- mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
+ mtr_add_arg($args, "%s--lc-messages-dir=%s", $prefix, $path_language);
mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
# Increase default connect_timeout to avoid intermittent
@@ -4011,8 +3974,6 @@ sub mysqld_arguments ($$$$) {
if ( $opt_valgrind_mysqld )
{
- mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
-
if ( $mysql_version_id < 50100 )
{
mtr_add_arg($args, "%s--skip-bdb", $prefix);
@@ -4066,11 +4027,6 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--local-infile", $prefix);
- if ( $idx > 0 or !$use_innodb)
- {
- mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
- }
-
my $cluster= $clusters->[$mysqld->{'cluster'}];
if ( $cluster->{'pid'} || # Cluster is started
$cluster->{'use_running'} ) # Using running cluster
@@ -4118,7 +4074,7 @@ sub mysqld_arguments ($$$$) {
my $slave_load_path= "../tmp";
mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
$slave_load_path);
- mtr_add_arg($args, "%s--set-variable=slave_net_timeout=120", $prefix);
+ mtr_add_arg($args, "%s--slave_net_timeout=120", $prefix);
if ( @$slave_master_info )
{
@@ -4129,15 +4085,26 @@ sub mysqld_arguments ($$$$) {
}
else
{
- if ($mysql_version_id < 50200)
- {
- mtr_add_arg($args, "%s--master-user=root", $prefix);
- mtr_add_arg($args, "%s--master-connect-retry=1", $prefix);
- mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix);
- mtr_add_arg($args, "%s--master-password=", $prefix);
- mtr_add_arg($args, "%s--master-port=%d", $prefix,
- $master->[0]->{'port'}); # First master
- }
+# NOTE: the backport (see BUG#48048) originally removed the
+# commented out lines below. However, given that they are
+# protected with a version check (< 50200) now, it should be
+# safe to keep them. The problem is that the backported patch
+# was into a 5.1 GA codebase - mysql-5.1-rep+2 tree - so
+# version is 501XX, consequently check becomes worthless. It
+# should be safe to uncomment them when merging up to 5.5.
+#
+# RQG semisync test runs on the 5.1 GA tree and needs MTR v1.
+# This was causing the test to fail (slave would not start
+# due to unrecognized option(s)).
+# if ($mysql_version_id < 50200)
+# {
+# mtr_add_arg($args, "%s--master-user=root", $prefix);
+# mtr_add_arg($args, "%s--master-connect-retry=1", $prefix);
+# mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix);
+# mtr_add_arg($args, "%s--master-password=", $prefix);
+# mtr_add_arg($args, "%s--master-port=%d", $prefix,
+# $master->[0]->{'port'}); # First master
+# }
my $slave_server_id= 2 + $idx;
my $slave_rpl_rank= $slave_server_id;
mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
@@ -4852,7 +4819,6 @@ sub run_check_testcase ($$) {
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--silent");
- mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
@@ -4935,7 +4901,6 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--silent");
- mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);