Commit cd88bccf by Jamie Madill Committed by Commit Bot

Test Runner: Command line sharding args override env.

Previously ANGLE would error out when both the enviornment and the command line args are specified at the same time. Because the perf bots use both at once we need to handle the conflict in the same way as the prior test runner does. In this case the command line takes precedence over the environment. Bug: angleproject:5124 Change-Id: I1ba765b4e75759922bf9fe2db9f153cfc5995f85 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2489722Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent fb44e93b
...@@ -853,27 +853,26 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -853,27 +853,26 @@ TestSuite::TestSuite(int *argc, char **argv)
++argIndex; ++argIndex;
} }
std::string envShardIndex = angle::GetEnvironmentVar("GTEST_SHARD_INDEX"); std::string envShardIndex = angle::GetEnvironmentVar("GTEST_SHARD_INDEX");
std::string envTotalShards = angle::GetEnvironmentVar("GTEST_TOTAL_SHARDS"); if (!envShardIndex.empty())
if (!envShardIndex.empty() || !envTotalShards.empty())
{ {
angle::UnsetEnvironmentVar("GTEST_SHARD_INDEX"); angle::UnsetEnvironmentVar("GTEST_SHARD_INDEX");
angle::UnsetEnvironmentVar("GTEST_TOTAL_SHARDS"); if (mShardIndex == -1)
if (mShardIndex != -1 || mShardCount != -1)
{ {
printf( std::stringstream shardIndexStream(envShardIndex);
"Error: --shard-index and --shard-count are incompatible with GTEST_SHARD_INDEX " shardIndexStream >> mShardIndex;
"and GTEST_TOTAL_SHARDS.\n");
exit(EXIT_FAILURE);
} }
}
std::stringstream shardIndexStream(envShardIndex); std::string envTotalShards = angle::GetEnvironmentVar("GTEST_TOTAL_SHARDS");
shardIndexStream >> mShardIndex; if (!envTotalShards.empty())
{
std::stringstream shardCountStream(envTotalShards); angle::UnsetEnvironmentVar("GTEST_TOTAL_SHARDS");
shardCountStream >> mShardCount; if (mShardCount == -1)
{
std::stringstream shardCountStream(envTotalShards);
shardCountStream >> mShardCount;
}
} }
if ((mShardIndex == -1) != (mShardCount == -1)) if ((mShardIndex == -1) != (mShardCount == -1))
......
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