Commit 867358b7 by Jamie Madill Committed by Commit Bot

Test Runner: Improve sharding validation.

The prior check was incorrectly flagging index=0/count=2 as invalid. It also missed a few cases like a shard count of 0. Bug: angleproject:3162 Change-Id: Ida4c0f454ece15e4304d024d205475acf0f135e6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2423207Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 4f6c6d5a
...@@ -812,7 +812,7 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -812,7 +812,7 @@ TestSuite::TestSuite(int *argc, char **argv)
++argIndex; ++argIndex;
} }
if ((mShardIndex > 0) != (mShardCount > 1)) if ((mShardIndex == -1) != (mShardCount == -1))
{ {
printf("Shard index and shard count must be specified together.\n"); printf("Shard index and shard count must be specified together.\n");
exit(1); exit(1);
...@@ -861,8 +861,19 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -861,8 +861,19 @@ TestSuite::TestSuite(int *argc, char **argv)
std::vector<TestIdentifier> testSet = GetFilteredTests(&mTestFileLines, alsoRunDisabledTests); std::vector<TestIdentifier> testSet = GetFilteredTests(&mTestFileLines, alsoRunDisabledTests);
if (mShardCount > 0) if (mShardCount == 0)
{ {
printf("Shard count must be > 0.\n");
exit(1);
}
else if (mShardCount > 0)
{
if (mShardIndex >= mShardCount)
{
printf("Shard index must be less than shard count.\n");
exit(1);
}
if (!angle::GetEnvironmentVar("GTEST_SHARD_INDEX").empty() || if (!angle::GetEnvironmentVar("GTEST_SHARD_INDEX").empty() ||
!angle::GetEnvironmentVar("GTEST_TOTAL_SHARDS").empty()) !angle::GetEnvironmentVar("GTEST_TOTAL_SHARDS").empty())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment