Commit 5f716573 authored by unknown's avatar unknown

Only uise one file for current test

Don't retry by default
Fixes for --embedded


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