From ce78bafe7a19bc3028d7da708816fef9b573fbe0 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Sun, 3 Dec 2017 21:25:07 +0300 Subject: [PATCH] MTR: MTR_COMBINATIONS envvar for tests MTR_COMBINATIONS contains comma-separated list of currently applied combinations "x,y,...". MTR_COMBINATION_X, MTR_COMBINATION_Y, ... are set to 1 for this list of combinations. Fixed dead check: non-existent element $tinfo->{combination}. Better use this clause: use warnings FATAL => 'uninitialized'; But this must be very well tested. --- mysql-test/mysql-test-run.pl | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 12e397c02d7..760a96587f0 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3758,14 +3758,32 @@ sub run_testcase ($$) { $ENV{'MTR_TEST_NAME'} = $tinfo->{name}; resfile_report_test($tinfo) if $opt_resfile; - # Allow only alpanumerics pluss _ - + . in combination names, - # or anything beginning with -- (the latter comes from --combination) - my $combination= $tinfo->{combination}; - if ($combination && $combination !~ /^\w[-\w\.\+]*$/ - && $combination !~ /^--/) + for my $key (grep { /^MTR_COMBINATION/ } keys %ENV) { - mtr_error("Combination '$combination' contains illegal characters"); + delete $ENV{$key}; } + + if (ref $tinfo->{combinations} eq 'ARRAY') + { + for (my $i = 0; $i < @{$tinfo->{combinations}}; ++$i ) + { + my $combination = $tinfo->{combinations}->[$i]; + # Allow only alphanumerics plus _ - + . in combination names, + # or anything beginning with -- (the latter comes from --combination) + if ($combination && $combination !~ /^\w[-\w\.\+]*$/ + && $combination !~ /^--/) + { + mtr_error("Combination '$combination' contains illegal characters"); + } + $ENV{"MTR_COMBINATION_". uc(${combination})} = 1; + } + $ENV{"MTR_COMBINATIONS"} = join(',', @{$tinfo->{combinations}}); + } + elsif (exists $tinfo->{combinations}) + { + die 'Unexpected type of $tinfo->{combinations}'; + } + # ------------------------------------------------------- # Init variables that can change between each test case # -------------------------------------------------------