@@ -31,7 +31,7 @@ our $skip_rpl;
31
31
our $do_test ;
32
32
our $skip_test ;
33
33
our $opt_skip_combination ;
34
- our $binlog_format ;;
34
+ our $binlog_format ;
35
35
our $enable_disabled ;
36
36
our $default_storage_engine ;
37
37
our $opt_with_ndbcluster_only ;
@@ -83,24 +83,25 @@ sub init_pattern {
83
83
#
84
84
# #############################################################################
85
85
86
- sub collect_test_cases ($) {
86
+ sub collect_test_cases ($$ ) {
87
87
my $suites = shift ; # Semicolon separated list of test suites
88
+ my $opt_cases = shift ;
88
89
my $cases = []; # Array of hash(one hash for each testcase)
89
90
90
91
$do_test_reg = init_pattern($do_test , " --do-test" );
91
92
$skip_test_reg = init_pattern($skip_test , " --skip-test" );
92
93
93
94
foreach my $suite (split (" ," , $suites ))
94
95
{
95
- push (@$cases , collect_one_suite($suite ));
96
+ push (@$cases , collect_one_suite($suite , $opt_cases ));
96
97
}
97
98
98
- if ( @:: opt_cases )
99
+ if ( @$ opt_cases )
99
100
{
100
101
# A list of tests was specified on the command line
101
102
# Check that the tests specified was found
102
103
# in at least one suite
103
- foreach my $test_name_spec ( @:: opt_cases )
104
+ foreach my $test_name_spec ( @$ opt_cases )
104
105
{
105
106
my $found = 0;
106
107
my ($sname , $tname , $extension )= split_testname($test_name_spec );
@@ -236,6 +237,7 @@ sub split_testname {
236
237
sub collect_one_suite ($)
237
238
{
238
239
my $suite = shift ; # Test suite name
240
+ my $opt_cases = shift ;
239
241
my @cases ; # Array of hash
240
242
241
243
mtr_verbose(" Collecting: $suite " );
@@ -304,10 +306,10 @@ sub collect_one_suite($)
304
306
$suite_opts = opts_from_file($suite_opt_file );
305
307
}
306
308
307
- if ( @:: opt_cases )
309
+ if ( @$ opt_cases )
308
310
{
309
311
# Collect in specified order
310
- foreach my $test_name_spec ( @:: opt_cases )
312
+ foreach my $test_name_spec ( @$ opt_cases )
311
313
{
312
314
my ($sname , $tname , $extension )= split_testname($test_name_spec );
313
315
@@ -428,9 +430,15 @@ sub collect_one_suite($)
428
430
{
429
431
foreach my $test (@cases )
430
432
{
431
- # print $test->{name}, " ", $comb, "\n";
432
- my $new_test = {};
433
+ # Skip this combination if the values it provides
434
+ # already are set in master_opt or slave_opt
435
+ if (My::Options::is_set($test -> {master_opt }, $comb -> {comb_opt }) &&
436
+ My::Options::is_set($test -> {slave_opt }, $comb -> {comb_opt }) ){
437
+ next ;
438
+ }
433
439
440
+ # Copy test options
441
+ my $new_test = {};
434
442
while (my ($key , $value ) = each (%$test )) {
435
443
if (ref $value eq " ARRAY" ) {
436
444
push (@{$new_test -> {$key }}, @$value );
@@ -450,6 +458,18 @@ sub collect_one_suite($)
450
458
push (@new_cases , $new_test );
451
459
}
452
460
}
461
+
462
+ # Add the plain test if it was not already added
463
+ # as part of a combination
464
+ my %added ;
465
+ foreach my $new_test (@new_cases ){
466
+ $added {$new_test -> {name }}= 1;
467
+ }
468
+ foreach my $test (@cases ){
469
+ push (@new_cases , $test ) unless $added {$test -> {name }};
470
+ }
471
+
472
+
453
473
# print_testcases(@new_cases);
454
474
@cases = @new_cases ;
455
475
# print_testcases(@cases);
@@ -481,13 +501,16 @@ sub optimize_cases {
481
501
# --mysqld=--binlog-format=x, skip all test that does not
482
502
# support it
483
503
# =======================================================
504
+ # print "binlog_format: $binlog_format\n";
484
505
if (defined $binlog_format )
485
506
{
486
507
# =======================================================
487
508
# Fixed --binlog-format=x specified on command line
488
509
# =======================================================
489
510
if ( defined $tinfo -> {' binlog_formats' } )
490
511
{
512
+ # print "binlog_formats: ". join(", ", @{$tinfo->{binlog_formats}})."\n";
513
+
491
514
# The test supports different binlog formats
492
515
# check if the selected one is ok
493
516
my $supported =
@@ -513,23 +536,18 @@ sub optimize_cases {
513
536
mtr_match_prefix($opt , " --binlog-format=" ) || $test_binlog_format ;
514
537
}
515
538
516
- if (defined $test_binlog_format )
539
+ if (defined $test_binlog_format and
540
+ defined $tinfo -> {binlog_formats } )
517
541
{
518
- if ( defined $tinfo -> {binlog_formats } )
542
+ my $supported =
543
+ grep { $_ eq $test_binlog_format } @{$tinfo -> {' binlog_formats' }};
544
+ if ( !$supported )
519
545
{
520
- my $supported =
521
- grep { $_ eq $test_binlog_format } @{$tinfo -> {' binlog_formats' }};
522
- if ( !$supported )
523
- {
524
- $tinfo -> {' skip' }= 1;
525
- $tinfo -> {' comment' }=
526
- " Doesn't support --binlog-format='$test_binlog_format '" ;
527
- next ;
528
- }
546
+ $tinfo -> {' skip' }= 1;
547
+ $tinfo -> {' comment' }=
548
+ " Doesn't support --binlog-format='$test_binlog_format '" ;
549
+ next ;
529
550
}
530
-
531
- # Save binlog format for dynamic switching
532
- $tinfo -> {binlog_format_switch }= $test_binlog_format ;
533
551
}
534
552
}
535
553
}
@@ -882,6 +900,12 @@ sub collect_one_test_case {
882
900
$tinfo -> {extra_template_path }= $defaults_extra_file ;
883
901
}
884
902
903
+ # ----------------------------------------------------------------------
904
+ # Append mysqld extra options to both master and slave
905
+ # ----------------------------------------------------------------------
906
+ push (@{$tinfo -> {' master_opt' }}, @::opt_extra_mysqld_opt );
907
+ push (@{$tinfo -> {' slave_opt' }}, @::opt_extra_mysqld_opt );
908
+
885
909
return $tinfo ;
886
910
}
887
911
0 commit comments