Skip to content

Commit c7a02cf

Browse files
Bjorn MunchBjorn Munch
authored andcommitted
merge from 5.1-mtr
2 parents ee56b11 + 684b1d3 commit c7a02cf

File tree

13 files changed

+129
-37
lines changed

13 files changed

+129
-37
lines changed

client/mysqltest.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7720,6 +7720,7 @@ int main(int argc, char **argv)
77207720
if (!ok_to_do)
77217721
{
77227722
if (command->type == Q_SOURCE ||
7723+
command->type == Q_ERROR ||
77237724
command->type == Q_WRITE_FILE ||
77247725
command->type == Q_APPEND_FILE ||
77257726
command->type == Q_PERL)

mysql-test/collections/default.experimental

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# For easier human reading (MTR doesn't care), please keep entries
2+
# in alphabetical order. This also helps with merge conflict resolution.
3+
14
binlog.binlog_multi_engine # joro : NDB tests marked as experimental as agreed with bochklin
25

36
funcs_1.charset_collation_1 # depends on compile-time decisions

mysql-test/include/check-warnings.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ if (`select @result = 0`){
5757
skip OK;
5858
}
5959
--enable_query_log
60-
echo ^ Found warnings!!;
60+
echo ^ Found warnings in $log_error;
6161
exit;

mysql-test/include/mtr_warnings.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ INSERT INTO global_suppressions VALUES
162162
("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
163163
("Slave: Can't DROP 'c7'.* 1091"),
164164
("Slave: Key column 'c6'.* 1072"),
165-
("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
165+
("The slave I.O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
166166
(".SELECT UNIX_TIMESTAMP... failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"),
167167

168168
/* Test case for Bug#31590 in order_by.test produces the following error */
@@ -210,7 +210,7 @@ BEGIN
210210
WHERE suspicious=1;
211211

212212
IF @num_warnings > 0 THEN
213-
SELECT file_name, line
213+
SELECT line
214214
FROM error_log WHERE suspicious=1;
215215
--SELECT * FROM test_suppressions;
216216
-- Return 2 -> check failed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
let $is_win = `select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows")`;
2+
let $is_embedded = `select version() like '%embedded%'`;
3+
#echo is_win: $is_win;
4+
#echo is_embedded: $is_embedded;
5+
if ($is_win)
6+
{
7+
if ($is_embedded)
8+
{
9+
skip Not supported with embedded on windows;
10+
}
11+
}

mysql-test/lib/My/SafeProcess/safe_kill_win.cc

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main(int argc, const char** argv )
3030
DWORD pid= -1;
3131
HANDLE shutdown_event;
3232
char safe_process_name[32]= {0};
33-
int retry_open_event= 100;
33+
int retry_open_event= 2;
3434
/* Ignore any signals */
3535
signal(SIGINT, SIG_IGN);
3636
signal(SIGBREAK, SIG_IGN);
@@ -51,15 +51,31 @@ int main(int argc, const char** argv )
5151
{
5252
/*
5353
Check if the process is alive, otherwise there is really
54-
no idea to retry the open of the event
54+
no sense to retry the open of the event
5555
*/
5656
HANDLE process;
57-
if ((process= OpenProcess(SYNCHRONIZE, FALSE, pid)) == NULL)
57+
DWORD exit_code;
58+
process= OpenProcess(SYNCHRONIZE| PROCESS_QUERY_INFORMATION, FALSE, pid);
59+
if (!process)
5860
{
59-
fprintf(stderr, "Could not open event or process %d, error: %d\n",
60-
pid, GetLastError());
61-
exit(3);
61+
/* Already died */
62+
exit(1);
63+
}
64+
65+
if (!GetExitCodeProcess(process,&exit_code))
66+
{
67+
fprintf(stderr, "GetExitCodeProcess failed, pid= %d, err= %d\n",
68+
pid, GetLastError());
69+
exit(1);
6270
}
71+
72+
if (exit_code != STILL_ACTIVE)
73+
{
74+
/* Already died */
75+
CloseHandle(process);
76+
exit(2);
77+
}
78+
6379
CloseHandle(process);
6480

6581
if (retry_open_event--)

mysql-test/lib/mtr_cases.pm

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,11 +545,11 @@ sub collect_one_suite($)
545545
push(@{$new_test->{slave_opt}}, "--plugin_load=$plugin_list");
546546
if ($new_test->{combination})
547547
{
548-
$new_test->{combination}.= ' + InnoDB plugin';
548+
$new_test->{combination}.= '+innodb_plugin';
549549
}
550550
else
551551
{
552-
$new_test->{combination}= 'InnoDB plugin';
552+
$new_test->{combination}= 'innodb_plugin';
553553
}
554554
push(@new_cases, $new_test);
555555
}
@@ -1042,6 +1042,17 @@ sub collect_one_test_case {
10421042
}
10431043
}
10441044

1045+
if ( $tinfo->{'need_ssl'} )
1046+
{
1047+
# This is a test that needs ssl
1048+
if ( ! $::opt_ssl_supported ) {
1049+
# SSL is not supported, skip it
1050+
$tinfo->{'skip'}= 1;
1051+
$tinfo->{'comment'}= "No SSL support";
1052+
return $tinfo;
1053+
}
1054+
}
1055+
10451056
# ----------------------------------------------------------------------
10461057
# Find config file to use if not already selected in <testname>.opt file
10471058
# ----------------------------------------------------------------------
@@ -1122,6 +1133,7 @@ my @tags=
11221133
["include/ndb_master-slave.inc", "ndb_test", 1],
11231134
["federated.inc", "federated_test", 1],
11241135
["include/not_embedded.inc", "not_embedded", 1],
1136+
["include/have_ssl.inc", "need_ssl", 1],
11251137
);
11261138

11271139

mysql-test/lib/mtr_report.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ sub mtr_report_test ($) {
146146
}
147147
}
148148
$fail = "exp-fail";
149+
$tinfo->{exp_fail}= 1;
149150
last;
150151
}
151152
}

mysql-test/mysql-test-run.pl

Lines changed: 68 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ END
144144
my $opt_compress;
145145
my $opt_ssl;
146146
my $opt_skip_ssl;
147-
my $opt_ssl_supported;
147+
our $opt_ssl_supported;
148148
my $opt_ps_protocol;
149149
my $opt_sp_protocol;
150150
my $opt_cursor_protocol;
@@ -323,7 +323,8 @@ sub main {
323323
for my $limit (2000, 1500, 1000, 500){
324324
$opt_parallel-- if ($sys_info->min_bogomips() < $limit);
325325
}
326-
$opt_parallel= 8 if ($opt_parallel > 8);
326+
my $max_par= $ENV{MTR_MAX_PARALLEL} || 8;
327+
$opt_parallel= $max_par if ($opt_parallel > $max_par);
327328
$opt_parallel= $num_tests if ($opt_parallel > $num_tests);
328329
$opt_parallel= 1 if (IS_WINDOWS and $sys_info->isvm());
329330
$opt_parallel= 1 if ($opt_parallel < 1);
@@ -519,7 +520,8 @@ ($$$)
519520
}
520521
}
521522
$num_saved_datadir++;
522-
$num_failed_test++ unless $result->{retries};
523+
$num_failed_test++ unless ($result->{retries} ||
524+
$result->{exp_fail});
523525

524526
if ( !$opt_force ) {
525527
# Test has failed, force is off
@@ -738,6 +740,7 @@ ($)
738740
}
739741
elsif ($line eq 'BYE'){
740742
mtr_report("Server said BYE");
743+
stop_all_servers($opt_shutdown_timeout);
741744
exit(0);
742745
}
743746
else {
@@ -1337,6 +1340,9 @@ sub command_line_setup {
13371340
push(@valgrind_args, @default_valgrind_args)
13381341
unless @valgrind_args;
13391342

1343+
# Make valgrind run in quiet mode so it only print errors
1344+
push(@valgrind_args, "--quiet" );
1345+
13401346
mtr_report("Running valgrind with options \"",
13411347
join(" ", @valgrind_args), "\"");
13421348
}
@@ -1794,7 +1800,7 @@ sub environment_setup {
17941800
# --------------------------------------------------------------------------
17951801
# Add the path where mysqld will find ha_example.so
17961802
# --------------------------------------------------------------------------
1797-
if ($mysql_version_id >= 50100 && !(IS_WINDOWS && $opt_embedded_server)) {
1803+
if ($mysql_version_id >= 50100) {
17981804
my $plugin_filename;
17991805
if (IS_WINDOWS)
18001806
{
@@ -3012,7 +3018,8 @@ ($$)
30123018
# Unknown process returned, most likley a crash, abort everything
30133019
$tinfo->{comment}=
30143020
"The server $proc crashed while running ".
3015-
"'check testcase $mode test'";
3021+
"'check testcase $mode test'".
3022+
get_log_from_proc($proc, $tinfo->{name});
30163023
$result= 3;
30173024
}
30183025

@@ -3130,7 +3137,8 @@ ($$)
31303137
else {
31313138
# Unknown process returned, most likley a crash, abort everything
31323139
$tinfo->{comment}.=
3133-
"The server $proc crashed while running '$run'";
3140+
"The server $proc crashed while running '$run'".
3141+
get_log_from_proc($proc, $tinfo->{name});
31343142
}
31353143

31363144
# Kill any check processes still running
@@ -3244,6 +3252,12 @@ ($)
32443252

32453253
mtr_verbose("Running test:", $tinfo->{name});
32463254

3255+
# Allow only alpanumerics pluss _ - + . in combination names
3256+
my $combination= $tinfo->{combination};
3257+
if ($combination && $combination !~ /^\w[-\w\.\+]+$/)
3258+
{
3259+
mtr_error("Combination '$combination' contains illegal characters");
3260+
}
32473261
# -------------------------------------------------------
32483262
# Init variables that can change between each test case
32493263
# -------------------------------------------------------
@@ -3436,14 +3450,14 @@ ($)
34363450
my $check_res;
34373451
if ( restart_forced_by_test() )
34383452
{
3439-
stop_all_servers();
3453+
stop_all_servers($opt_shutdown_timeout);
34403454
}
34413455
elsif ( $opt_check_testcases and
34423456
$check_res= check_testcase($tinfo, "after"))
34433457
{
34443458
if ($check_res == 1) {
34453459
# Test case had sideeffects, not fatal error, just continue
3446-
stop_all_servers();
3460+
stop_all_servers($opt_shutdown_timeout);
34473461
mtr_report("Resuming tests...\n");
34483462
}
34493463
else {
@@ -3524,7 +3538,8 @@ ($)
35243538
{
35253539
# Server failed, probably crashed
35263540
$tinfo->{comment}=
3527-
"Server $proc failed during test run";
3541+
"Server $proc failed during test run" .
3542+
get_log_from_proc($proc, $tinfo->{name});
35283543

35293544
# ----------------------------------------------------
35303545
# It's not mysqltest that has exited, kill it
@@ -3579,12 +3594,11 @@ ($)
35793594
}
35803595

35813596

3597+
# Extract server log from after the last occurrence of named test
3598+
# Return as an array of lines
35823599
#
3583-
# Perform a rough examination of the servers
3584-
# error log and write all lines that look
3585-
# suspicious into $error_log.warnings
3586-
#
3587-
sub extract_warning_lines ($$) {
3600+
3601+
sub extract_server_log ($$) {
35883602
my ($error_log, $tname) = @_;
35893603

35903604
# Open the servers .err log file and read all lines
@@ -3636,23 +3650,47 @@ ($$)
36363650
}
36373651
}
36383652
}
3653+
return @lines;
3654+
}
36393655

3640-
# Write all suspicious lines to $error_log.warnings file
3656+
# Get log from server identified from its $proc object, from named test
3657+
# Return as a single string
3658+
#
3659+
3660+
sub get_log_from_proc ($$) {
3661+
my ($proc, $name)= @_;
3662+
my $srv_log= "";
3663+
3664+
foreach my $mysqld (mysqlds()) {
3665+
if ($mysqld->{proc} eq $proc) {
3666+
my @srv_lines= extract_server_log($mysqld->value('#log-error'), $name);
3667+
$srv_log= "\nServer log from this test:\n" . join ("", @srv_lines);
3668+
last;
3669+
}
3670+
}
3671+
return $srv_log;
3672+
}
3673+
3674+
# Perform a rough examination of the servers
3675+
# error log and write all lines that look
3676+
# suspicious into $error_log.warnings
3677+
#
3678+
sub extract_warning_lines ($$) {
3679+
my ($error_log, $tname) = @_;
3680+
3681+
my @lines= extract_server_log($error_log, $tname);
3682+
3683+
# Write all suspicious lines to $error_log.warnings file
36413684
my $warning_log = "$error_log.warnings";
36423685
my $Fwarn = IO::File->new($warning_log, "w")
36433686
or die("Could not open file '$warning_log' for writing: $!");
36443687
print $Fwarn "Suspicious lines from $error_log\n";
36453688

36463689
my @patterns =
36473690
(
3648-
# The patterns for detection of [Warning] and [ERROR]
3649-
# in the server log files have been faulty for a longer period
3650-
# and correcting them shows a few additional harmless warnings.
3651-
# Thus those patterns are temporarily removed from the list
3652-
# of patterns. For more info see BUG#42408
36533691
qr/^Warning:|mysqld: Warning|\[Warning\]/,
36543692
qr/^Error:|\[ERROR\]/,
3655-
qr/^==.* at 0x/,
3693+
qr/^==\d*==/, # valgrind errors
36563694
qr/InnoDB: Warning|InnoDB: Error/,
36573695
qr/^safe_mutex:|allocated at line/,
36583696
qr/missing DBUG_RETURN/,
@@ -3825,7 +3863,8 @@ ($)
38253863
else {
38263864
# Unknown process returned, most likley a crash, abort everything
38273865
$tinfo->{comment}=
3828-
"The server $proc crashed while running 'check warnings'";
3866+
"The server $proc crashed while running 'check warnings'".
3867+
get_log_from_proc($proc, $tinfo->{name});
38293868
$result= 3;
38303869
}
38313870

@@ -4084,6 +4123,7 @@ sub mysqld_stop {
40844123
mtr_init_args(\$args);
40854124

40864125
mtr_add_arg($args, "--no-defaults");
4126+
mtr_add_arg($args, "--character-sets-dir=%s", $mysqld->value('character-sets-dir'));
40874127
mtr_add_arg($args, "--user=%s", $opt_user);
40884128
mtr_add_arg($args, "--password=");
40894129
mtr_add_arg($args, "--port=%d", $mysqld->value('port'));
@@ -4281,7 +4321,8 @@ ($$)
42814321
$opt_start_timeout,
42824322
$mysqld->{'proc'}))
42834323
{
4284-
mtr_error("Failed to start mysqld $mysqld->name()");
4324+
my $mname= $mysqld->name();
4325+
mtr_error("Failed to start mysqld $mname with command $exe");
42854326
}
42864327

42874328
# Remember options used when starting
@@ -4292,11 +4333,12 @@ ($$)
42924333

42934334

42944335
sub stop_all_servers () {
4336+
my $shutdown_timeout = $_[0] or 0;
42954337

42964338
mtr_verbose("Stopping all servers...");
42974339

42984340
# Kill all started servers
4299-
My::SafeProcess::shutdown(0, # shutdown timeout 0 => kill
4341+
My::SafeProcess::shutdown($shutdown_timeout,
43004342
started(all_servers()));
43014343

43024344
# Remove pidfiles
@@ -4667,7 +4709,8 @@ ($)
46674709
my $logfile= $mysqld->value('#log-error');
46684710
if ( defined $logfile and -f $logfile )
46694711
{
4670-
$tinfo->{logfile}= mtr_fromfile($logfile);
4712+
my @srv_lines= extract_server_log($logfile, $tinfo->{name});
4713+
$tinfo->{logfile}= "Server log is:\n" . join ("", @srv_lines);
46714714
}
46724715
else
46734716
{
@@ -5084,7 +5127,6 @@ sub valgrind_arguments {
50845127
else
50855128
{
50865129
mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
5087-
mtr_add_arg($args, "--alignment=8");
50885130
mtr_add_arg($args, "--leak-check=yes");
50895131
mtr_add_arg($args, "--num-callers=16");
50905132
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)

0 commit comments

Comments
 (0)