144
144
my $opt_compress ;
145
145
my $opt_ssl ;
146
146
my $opt_skip_ssl ;
147
- my $opt_ssl_supported ;
147
+ our $opt_ssl_supported ;
148
148
my $opt_ps_protocol ;
149
149
my $opt_sp_protocol ;
150
150
my $opt_cursor_protocol ;
@@ -323,7 +323,8 @@ sub main {
323
323
for my $limit (2000, 1500, 1000, 500){
324
324
$opt_parallel -- if ($sys_info -> min_bogomips() < $limit );
325
325
}
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 );
327
328
$opt_parallel = $num_tests if ($opt_parallel > $num_tests );
328
329
$opt_parallel = 1 if (IS_WINDOWS and $sys_info -> isvm());
329
330
$opt_parallel = 1 if ($opt_parallel < 1);
@@ -519,7 +520,8 @@ ($$$)
519
520
}
520
521
}
521
522
$num_saved_datadir ++;
522
- $num_failed_test ++ unless $result -> {retries };
523
+ $num_failed_test ++ unless ($result -> {retries } ||
524
+ $result -> {exp_fail });
523
525
524
526
if ( !$opt_force ) {
525
527
# Test has failed, force is off
738
740
}
739
741
elsif ($line eq ' BYE' ){
740
742
mtr_report(" Server said BYE" );
743
+ stop_all_servers($opt_shutdown_timeout );
741
744
exit (0);
742
745
}
743
746
else {
@@ -1337,6 +1340,9 @@ sub command_line_setup {
1337
1340
push (@valgrind_args , @default_valgrind_args )
1338
1341
unless @valgrind_args ;
1339
1342
1343
+ # Make valgrind run in quiet mode so it only print errors
1344
+ push (@valgrind_args , " --quiet" );
1345
+
1340
1346
mtr_report(" Running valgrind with options \" " ,
1341
1347
join (" " , @valgrind_args ), " \" " );
1342
1348
}
@@ -1794,7 +1800,7 @@ sub environment_setup {
1794
1800
# --------------------------------------------------------------------------
1795
1801
# Add the path where mysqld will find ha_example.so
1796
1802
# --------------------------------------------------------------------------
1797
- if ($mysql_version_id >= 50100 && !(IS_WINDOWS && $opt_embedded_server ) ) {
1803
+ if ($mysql_version_id >= 50100) {
1798
1804
my $plugin_filename ;
1799
1805
if (IS_WINDOWS)
1800
1806
{
@@ -3012,7 +3018,8 @@ ($$)
3012
3018
# Unknown process returned, most likley a crash, abort everything
3013
3019
$tinfo -> {comment }=
3014
3020
" The server $proc crashed while running " .
3015
- " 'check testcase $mode test'" ;
3021
+ " 'check testcase $mode test'" .
3022
+ get_log_from_proc($proc , $tinfo -> {name });
3016
3023
$result = 3;
3017
3024
}
3018
3025
@@ -3130,7 +3137,8 @@ ($$)
3130
3137
else {
3131
3138
# Unknown process returned, most likley a crash, abort everything
3132
3139
$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 });
3134
3142
}
3135
3143
3136
3144
# Kill any check processes still running
@@ -3244,6 +3252,12 @@ ($)
3244
3252
3245
3253
mtr_verbose(" Running test:" , $tinfo -> {name });
3246
3254
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
+ }
3247
3261
# -------------------------------------------------------
3248
3262
# Init variables that can change between each test case
3249
3263
# -------------------------------------------------------
@@ -3436,14 +3450,14 @@ ($)
3436
3450
my $check_res ;
3437
3451
if ( restart_forced_by_test() )
3438
3452
{
3439
- stop_all_servers();
3453
+ stop_all_servers($opt_shutdown_timeout );
3440
3454
}
3441
3455
elsif ( $opt_check_testcases and
3442
3456
$check_res = check_testcase($tinfo , " after" ))
3443
3457
{
3444
3458
if ($check_res == 1) {
3445
3459
# Test case had sideeffects, not fatal error, just continue
3446
- stop_all_servers();
3460
+ stop_all_servers($opt_shutdown_timeout );
3447
3461
mtr_report(" Resuming tests...\n " );
3448
3462
}
3449
3463
else {
@@ -3524,7 +3538,8 @@ ($)
3524
3538
{
3525
3539
# Server failed, probably crashed
3526
3540
$tinfo -> {comment }=
3527
- " Server $proc failed during test run" ;
3541
+ " Server $proc failed during test run" .
3542
+ get_log_from_proc($proc , $tinfo -> {name });
3528
3543
3529
3544
# ----------------------------------------------------
3530
3545
# It's not mysqltest that has exited, kill it
@@ -3579,12 +3594,11 @@ ($)
3579
3594
}
3580
3595
3581
3596
3597
+ # Extract server log from after the last occurrence of named test
3598
+ # Return as an array of lines
3582
3599
#
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 ($$) {
3588
3602
my ($error_log , $tname ) = @_ ;
3589
3603
3590
3604
# Open the servers .err log file and read all lines
@@ -3636,23 +3650,47 @@ ($$)
3636
3650
}
3637
3651
}
3638
3652
}
3653
+ return @lines ;
3654
+ }
3639
3655
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 = " \n Server 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
3641
3684
my $warning_log = " $error_log .warnings" ;
3642
3685
my $Fwarn = IO::File-> new($warning_log , " w" )
3643
3686
or die (" Could not open file '$warning_log ' for writing: $! " );
3644
3687
print $Fwarn " Suspicious lines from $error_log \n " ;
3645
3688
3646
3689
my @patterns =
3647
3690
(
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
3653
3691
qr / ^Warning:|mysqld: Warning|\[ Warning\] / ,
3654
3692
qr / ^Error:|\[ ERROR\] / ,
3655
- qr / ^==.* at 0x / ,
3693
+ qr / ^==\d *== / , # valgrind errors
3656
3694
qr / InnoDB: Warning|InnoDB: Error/ ,
3657
3695
qr / ^safe_mutex:|allocated at line/ ,
3658
3696
qr / missing DBUG_RETURN/ ,
@@ -3825,7 +3863,8 @@ ($)
3825
3863
else {
3826
3864
# Unknown process returned, most likley a crash, abort everything
3827
3865
$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 });
3829
3868
$result = 3;
3830
3869
}
3831
3870
@@ -4084,6 +4123,7 @@ sub mysqld_stop {
4084
4123
mtr_init_args(\$args );
4085
4124
4086
4125
mtr_add_arg($args , " --no-defaults" );
4126
+ mtr_add_arg($args , " --character-sets-dir=%s " , $mysqld -> value(' character-sets-dir' ));
4087
4127
mtr_add_arg($args , " --user=%s " , $opt_user );
4088
4128
mtr_add_arg($args , " --password=" );
4089
4129
mtr_add_arg($args , " --port=%d " , $mysqld -> value(' port' ));
@@ -4281,7 +4321,8 @@ ($$)
4281
4321
$opt_start_timeout ,
4282
4322
$mysqld -> {' proc' }))
4283
4323
{
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 " );
4285
4326
}
4286
4327
4287
4328
# Remember options used when starting
@@ -4292,11 +4333,12 @@ ($$)
4292
4333
4293
4334
4294
4335
sub stop_all_servers () {
4336
+ my $shutdown_timeout = $_ [0] or 0;
4295
4337
4296
4338
mtr_verbose(" Stopping all servers..." );
4297
4339
4298
4340
# Kill all started servers
4299
- My::SafeProcess::shutdown (0, # shutdown timeout 0 => kill
4341
+ My::SafeProcess::shutdown ($shutdown_timeout ,
4300
4342
started(all_servers()));
4301
4343
4302
4344
# Remove pidfiles
@@ -4667,7 +4709,8 @@ ($)
4667
4709
my $logfile = $mysqld -> value(' #log-error' );
4668
4710
if ( defined $logfile and -f $logfile )
4669
4711
{
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 );
4671
4714
}
4672
4715
else
4673
4716
{
@@ -5084,7 +5127,6 @@ sub valgrind_arguments {
5084
5127
else
5085
5128
{
5086
5129
mtr_add_arg($args , " --tool=memcheck" ); # From >= 2.1.2 needs this option
5087
- mtr_add_arg($args , " --alignment=8" );
5088
5130
mtr_add_arg($args , " --leak-check=yes" );
5089
5131
mtr_add_arg($args , " --num-callers=16" );
5090
5132
mtr_add_arg($args , " --suppressions=%s /valgrind.supp" , $glob_mysql_test_dir )
0 commit comments