From 3320a4bffb715c7596d9daded90ff1b37e8229f2 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 6 Feb 2012 22:55:17 +0100 Subject: per-combination result files --- mysql-test/lib/mtr_cases.pm | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'mysql-test/lib') diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 758d87303a8..cd90f4bea43 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -616,20 +616,6 @@ sub collect_one_test_case { suite => $suites{$suitename}, ); - my $result_file= "$resdir/$tname.result"; - if (-f $result_file) { - # Allow nonexistsing result file - # in that case .test must issue "exit" otherwise test - # should fail by default - $tinfo->{result_file}= $result_file; - } - else { - # No .result file exist - # Remember the path where it should be - # saved in case of --record - $tinfo->{record_file}= $result_file; - } - # ---------------------------------------------------------------------- # Skip some tests but include in list, just mark them as skipped # ---------------------------------------------------------------------- @@ -871,6 +857,36 @@ sub collect_one_test_case { { @cases = map make_combinations($_, @{$comb}), @cases; } + + for $tinfo (@cases) { + if ($tinfo->{combinations}) { + my $re = '(?:' . join('|', @{$tinfo->{combinations}}) . ')'; + my $found = 0; + for (<$resdir/$tname,*.result>) { + m|$tname((?:,$re)+)\.result$| or next; + my $combs = $&; + my @commas = ($combs =~ m/,/g); + # prefer the most specific result file + if (@commas > $found) { + $found = @commas; + $tinfo->{result_file} = $_; + } + } + } + + unless (defined $tinfo->{result_file}) { + my $result_file= "$resdir/$tname.result"; + if (-f $result_file) { + $tinfo->{result_file}= $result_file; + } else { + # No .result file exist + # Remember the path where it should be + # saved in case of --record + $tinfo->{record_file}= $result_file; + } + } + } + return @cases; } -- cgit v1.2.1