Skip to content

Commit 2fcd88e

Browse files
committed
Tests: order bot mode batch configs alphabetically
Currently ordered by hashmap key ordering which shuffles the order even with --max-processes=1. Adding a sort to make this deterministic. Bug: angleproject:408276172 Change-Id: Ice96e350ba4247a1f40870e275d04d2f654bc4f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6438024 Reviewed-by: Yuly Novikov <[email protected]> Commit-Queue: Roman Lavrov <[email protected]>
1 parent 8424dd2 commit 2fcd88e

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/tests/test_utils/runner/TestSuite.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,19 +725,28 @@ std::string GetConfigNameFromTestIdentifier(const TestIdentifier &id)
725725

726726
TestQueue BatchTests(const std::vector<TestIdentifier> &tests, int batchSize)
727727
{
728-
// First sort tests by configuration.
729-
angle::HashMap<std::string, std::vector<TestIdentifier>> testsSortedByConfig;
728+
// First group tests by configuration.
729+
angle::HashMap<std::string, std::vector<TestIdentifier>> testsGroupedByConfig;
730730
for (const TestIdentifier &id : tests)
731731
{
732732
std::string config = GetConfigNameFromTestIdentifier(id);
733-
testsSortedByConfig[config].push_back(id);
733+
testsGroupedByConfig[config].push_back(id);
734734
}
735735

736+
// Sort configs for consistent ordering.
737+
std::vector<std::string> configs;
738+
configs.reserve(testsGroupedByConfig.size());
739+
for (const auto &configAndIds : testsGroupedByConfig)
740+
{
741+
configs.push_back(configAndIds.first);
742+
}
743+
std::sort(configs.begin(), configs.end());
744+
736745
// Then group into batches by 'batchSize'.
737746
TestQueue testQueue;
738-
for (const auto &configAndIds : testsSortedByConfig)
747+
for (const auto &config : configs)
739748
{
740-
const std::vector<TestIdentifier> &configTests = configAndIds.second;
749+
const std::vector<TestIdentifier> &configTests = testsGroupedByConfig[config];
741750

742751
// Count the number of batches needed for this config.
743752
int batchesForConfig = static_cast<int>(configTests.size() + batchSize - 1) / batchSize;

0 commit comments

Comments
 (0)