diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index d4882d60e6c..f1008fae360 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -352,14 +352,22 @@ sub post_check_client_groups { # needed from first [mysqld.] # sub post_check_embedded_group { - my ($self, $config)= @_; + my ($self, $config)= @_; - return unless $self->{ARGS}->{embedded}; + return unless $self->{ARGS}->{embedded}; - my $first_mysqld= $config->first_like('mysqld.') or - croak "Can't run with embedded, config has no mysqld"; + my $first_mysqld= $config->first_like('mysqld.') or + croak "Can't run with embedded, config has no mysqld"; + + my @no_copy = + ( + 'log-error', # Embedded server writes stderr to mysqltest's log file + ); foreach my $option ( $first_mysqld->options() ) { + # Don't copy options whose name is in "no_copy" list + next if grep ( $option->name() eq $_, @no_copy); + $config->insert('embedded', $option->name(), $option->value()) } diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 488ff21dabb..98c36ad572b 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -891,6 +891,16 @@ sub collect_one_test_case { } } + if ( $::opt_embedded_server ) + { + if ( $tinfo->{'not_embedded'} ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Not run for embedded server"; + return $tinfo; + } + } + # ---------------------------------------------------------------------- # Find config file to use if not already selected in .opt file # ---------------------------------------------------------------------- @@ -960,6 +970,7 @@ my @tags= ["include/master-slave.inc", "rpl_test", 1], ["include/ndb_master-slave.inc", "rpl_test", 1], ["include/federated.inc", "federated_test", 1], + ["include/not_embedded.inc", "not_embedded", 1], ); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 315ff8ae1e6..6f58f0835bd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -66,8 +66,9 @@ our $basedir; our $path_charsetsdir; our $path_client_bindir; our $path_language; -our $path_timefile; -our $path_current_test_log; + +our $path_current_testlog; +our $path_testlog; our $default_vardir; our $opt_vardir; # Path to use for var/ dir @@ -112,7 +113,7 @@ our $opt_view_protocol; our $opt_debug; our @opt_cases; # The test cases names in argv -my $opt_embedded_server; +our $opt_embedded_server; # Options used when connecting to an already running server my %opts_extern; @@ -735,8 +736,8 @@ sub command_line_setup { # socket path names. $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 ); - $path_timefile= "$opt_vardir/log/mysqltest-time"; - $path_current_test_log= "$opt_vardir/log/current_test"; + $path_testlog= "$opt_vardir/log/mysqltest.log"; + $path_current_testlog= "$opt_vardir/log/current_test"; $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log"; } @@ -1753,7 +1754,7 @@ sub run_tests { { # Testcase failed, enter retry mode my $retries= 1; - while ($retries <= $opt_retry){ + while ($retries < $opt_retry){ mtr_report("\nRetrying, attempt($retries/$opt_retry)...\n"); if (run_testcase($tinfo) <= 0) @@ -2097,6 +2098,8 @@ sub run_testcase_check_skip_test($) } } + + return 0; } @@ -2183,8 +2186,8 @@ sub find_testcase_skipped_reason($) # Set default message $tinfo->{'comment'}= "Detected by testcase(no log file)"; - # Open mysqltest-time(the mysqltest log file) - my $F= IO::File->new($path_timefile) + # Open the test log file + my $F= IO::File->new($path_current_testlog) or return; my $reason; @@ -2199,7 +2202,7 @@ sub find_testcase_skipped_reason($) if ( ! $reason ) { - mtr_warning("Could not find reason for skipping test in $path_timefile"); + mtr_warning("Could not find reason for skipping test in $path_current_testlog"); $reason= "Detected by testcase(reason unknown) "; } $tinfo->{'comment'}= $reason; @@ -2297,7 +2300,7 @@ sub run_testcase ($) { } # Write start of testcase to log - mark_log($path_current_test_log, $tinfo); + mark_log($path_current_testlog, $tinfo); if (start_servers($tinfo)) { @@ -2368,7 +2371,7 @@ sub run_testcase ($) { { # Testcase itself tell us to skip this one $tinfo->{skip_detected_by_test}= 1; - # Try to get reason from mysqltest.log + # Try to get reason from test log file find_testcase_skipped_reason($tinfo); mtr_report_test_skipped($tinfo); } @@ -2393,16 +2396,11 @@ sub run_testcase ($) { } # Save info from this testcase run to mysqltest.log - my $path_mysqltest_log= "$opt_vardir/log/mysqltest.log"; - mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log) - if -f $path_current_test_log; - mtr_appendfile_to_file($path_timefile, $path_mysqltest_log) - if -f $path_timefile; - - # Remove the file that mysqltest writes info to - unlink($path_timefile); - # Remove the file that mysql-test-run writes info to - unlink($path_current_test_log); + if( -f $path_current_testlog) + { + mtr_appendfile_to_file($path_current_testlog, $path_testlog); + unlink($path_current_testlog); + } return ($res == 62) ? 0 : $res; @@ -2548,7 +2546,7 @@ sub after_test_failure ($) { sub report_failure_and_restart ($) { my $tinfo= shift; - mtr_report_test_failed($tinfo, $path_timefile); + mtr_report_test_failed($tinfo, $path_current_testlog); print "\n"; if ( $opt_force ) { @@ -3321,7 +3319,8 @@ sub start_mysqltest ($) { name => "mysqltest", path => $exe, args => \$args, - error => $path_timefile, + append => 1, + error => $path_current_testlog, verbose => $opt_verbose, ); mtr_verbose("Started $proc"); diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 4cb300a223f..e222cf9b51e 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1588,7 +1588,7 @@ create table bug15205 (val int(11) not null) engine=csv; create table bug15205_2 (val int(11) not null) engine=csv; --remove_file $MYSQLD_DATADIR/test/bug15205.CSV # system error (can't open the datafile) ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' --error 13 select * from bug15205; select * from bug15205_2; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 8fdbbfcde79..8ab33a91e60 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1130,7 +1130,7 @@ drop table t2; # Test error handling # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' --error ER_WRONG_FK_DEF create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; @@ -1323,7 +1323,7 @@ source include/varchar.inc; # # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' create table t1 (v varchar(65530), key(v)); drop table t1; create table t1 (v varchar(65536)); @@ -1598,7 +1598,7 @@ disconnect b; set foreign_key_checks=0; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1005 create table t1(a char(10) primary key, b varchar(20)) engine = innodb; set foreign_key_checks=1; @@ -1610,7 +1610,7 @@ drop table t2; set foreign_key_checks=0; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1005 create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; set foreign_key_checks=1; @@ -1641,7 +1641,7 @@ set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1025 rename table t3 to t1; set foreign_key_checks=1; @@ -2269,7 +2269,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; # mysqltest first does replace_regex, then replace_result --replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' --error 1025 ALTER TABLE t2 MODIFY a INT NOT NULL; DELETE FROM t1; diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 42bf39890de..dff52ea4a0c 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -577,7 +577,7 @@ prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ; create table t5 (a int) ; # rename must fail, t7 does not exist # Clean up the filename here because embedded server reports whole path ---replace_result $MYSQLTEST_VARDIR . master-data/ '' t7.frm t7 +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' t7.frm t7 --error 1017 execute stmt1 ; create table t7 (a int) ; diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 688cf7a996c..f84fefbda34 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -1148,7 +1148,7 @@ dummy EOF chmod 0000 $MYSQLD_DATADIR/test/t1_ai.TRN~; # Normalize the datadir path; the embedded server doesn't chdir to datadir ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' --error 1 rename table t1 to t2; # 't1' should be still there and triggers should work correctly