Commit 23cff4e1 by Jamie Madill Committed by Commit Bot

Test Runner: Handle GTest sharding args.

These were messing up the test runner when used in combination with the test runner's specific args. Make it an error if the arguments are used together. Bug: angleproject:3162 Change-Id: I6fa1c0fb346a8c376ca455f7f4bf0492cfc0198a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2414931Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 22d30378
...@@ -66,12 +66,12 @@ def main(): ...@@ -66,12 +66,12 @@ def main():
env = os.environ.copy() env = os.environ.copy()
# total_shards = None
# shard_index = None
if 'GTEST_TOTAL_SHARDS' in env: if 'GTEST_TOTAL_SHARDS' in env:
extra_flags += ['--shard-count=' + env['GTEST_TOTAL_SHARDS']] extra_flags += ['--shard-count=' + env['GTEST_TOTAL_SHARDS']]
env.pop('GTEST_TOTAL_SHARDS')
if 'GTEST_SHARD_INDEX' in env: if 'GTEST_SHARD_INDEX' in env:
extra_flags += ['--shard-index=' + env['GTEST_SHARD_INDEX']] extra_flags += ['--shard-index=' + env['GTEST_SHARD_INDEX']]
env.pop('GTEST_SHARD_INDEX')
# Assume we want to set up the sandbox environment variables all the # Assume we want to set up the sandbox environment variables all the
# time; doing so is harmless on non-Linux platforms and is needed # time; doing so is harmless on non-Linux platforms and is needed
......
...@@ -836,7 +836,7 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -836,7 +836,7 @@ TestSuite::TestSuite(int *argc, char **argv)
if (mFilterString.substr(0, strlen("--gtest_filter=")) != std::string("--gtest_filter=")) if (mFilterString.substr(0, strlen("--gtest_filter=")) != std::string("--gtest_filter="))
{ {
printf("Filter file must start with \"--gtest_filter=\"."); printf("Filter file must start with \"--gtest_filter=\".\n");
exit(1); exit(1);
} }
...@@ -856,6 +856,15 @@ TestSuite::TestSuite(int *argc, char **argv) ...@@ -856,6 +856,15 @@ TestSuite::TestSuite(int *argc, char **argv)
if (mShardCount > 0) if (mShardCount > 0)
{ {
if (!angle::GetEnvironmentVar("GTEST_SHARD_INDEX").empty() ||
!angle::GetEnvironmentVar("GTEST_TOTAL_SHARDS").empty())
{
printf(
"Error: --shard-index and --shard-count are incompatible with GTEST_SHARD_INDEX "
"and GTEST_TOTAL_SHARDS.\n");
exit(1);
}
testSet = testSet =
GetShardTests(testSet, mShardIndex, mShardCount, &mTestFileLines, alsoRunDisabledTests); GetShardTests(testSet, mShardIndex, mShardCount, &mTestFileLines, alsoRunDisabledTests);
......
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