Skip to content

Commit 8684fb5

Browse files
author
Deepa Dixit
committed
Merge branch 'mysql-5.6' into mysql-5.7
2 parents 627a0b9 + 7a1c05c commit 8684fb5

File tree

2 files changed

+57
-14
lines changed

2 files changed

+57
-14
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)

mysql-test/lib/mtr_cases_from_list.pm

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- cperl -*-
2-
# Copyright (c) 2005, 2013, 2014, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
33
#
44
# This program is free software; you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -64,8 +64,9 @@ sub collect_test_cases_from_list ($$$$) {
6464
}
6565
# If not yet in list of suites add the suite to it.
6666
$$suites= $$suites.",".$suite if ($found);
67-
# Add test to list of tests even if double.
68-
push (@$opt_cases, $test);
67+
# Passing the qualified test name so that if --no-reorder
68+
# is passed, the test will not be looked for in all the suites.
69+
push (@$opt_cases, $suite.".".$test);
6970
}
7071
}
7172
if (@$opt_cases == 0) {

0 commit comments

Comments
 (0)