Skip to content

Commit 7a1c05c

Browse files
author
Deepa Dixit
committed
Merge branch 'mysql-5.5' into mysql-5.6
2 parents c2b1caa + 6a6d5bc commit 7a1c05c

File tree

1 file changed

+53
-11
lines changed

1 file changed

+53
-11
lines changed

mysql-test/lib/mtr_cases.pm

+53-11
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,13 @@ sub collect_test_cases ($$$$) {
143143

144144
if ( @$opt_cases )
145145
{
146-
# A list of tests was specified on the command line
146+
# A list of tests was specified on the command line.
147+
# Among those, the tests which are not already collected will be
148+
# collected and stored temporarily in an array of hashes pointed
149+
# by the below reference. This array is eventually appeneded to
150+
# the one having all collected test cases.
151+
my $cmdline_cases;
152+
147153
# Check that the tests specified was found
148154
# in at least one suite
149155
foreach my $test_name_spec ( @$opt_cases )
@@ -162,20 +168,56 @@ sub collect_test_cases ($$$$) {
162168
}
163169
if ( not $found )
164170
{
165-
$sname= "main" if !$opt_reorder and !$sname;
166-
mtr_error("Could not find '$tname' in '$suites' suite(s)") unless $sname;
167-
# If suite was part of name, find it there, may come with combinations
168-
my @this_case = collect_one_suite($sname, [ $tname ]);
169-
if (@this_case)
171+
if ( $sname )
170172
{
171-
push (@$cases, @this_case);
172-
}
173-
else
174-
{
175-
mtr_error("Could not find '$tname' in '$sname' suite");
173+
# If suite was part of name, find it there, may come with combinations
174+
my @this_case = collect_one_suite($sname, [ $tname ]);
175+
176+
# If a test is specified multiple times on the command line, all
177+
# instances of the test need to be picked. Hence, such tests are
178+
# stored in the temporary array instead of adding them to $cases
179+
# directly so that repeated tests are not run only once
180+
if (@this_case)
181+
{
182+
push (@$cmdline_cases, @this_case);
183+
}
184+
else
185+
{
186+
mtr_error("Could not find '$tname' in '$sname' suite");
187+
}
188+
}
189+
else
190+
{
191+
if ( !$opt_reorder )
192+
{
193+
# If --no-reorder is passed and if suite was not part of name,
194+
# search in all the suites
195+
foreach my $suite (split(",", $suites))
196+
{
197+
my @this_case = collect_one_suite($suite, [ $tname ]);
198+
if ( @this_case )
199+
{
200+
push (@$cmdline_cases, @this_case);
201+
$found= 1;
202+
}
203+
@this_case= collect_one_suite("i_".$suite, [ $tname ]);
204+
if ( @this_case )
205+
{
206+
push (@$cmdline_cases, @this_case);
207+
$found= 1;
208+
}
209+
}
210+
}
211+
if ( !$found )
212+
{
213+
mtr_error("Could not find '$tname' in '$suites' suite(s)");
214+
}
176215
}
177216
}
178217
}
218+
# Add test cases collected in the temporary array to the one
219+
# containing all previously collected test cases
220+
push (@$cases, @$cmdline_cases) if $cmdline_cases;
179221
}
180222

181223
if ( $opt_reorder && !$quick_collect)

0 commit comments

Comments
 (0)