aboutsummaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
authorehmaldonado <ehmaldonado@webrtc.org>2016-12-07 08:52:15 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-07 16:52:21 +0000
commitdd33e63378a5ccb134bb52f935f67cd58c904e98 (patch)
tree43daa3ea031e18229df6437c6d861e45309504fd /third_party
parent157a34dd35cd062ba3e9b6faa2aedba2fbdd242e (diff)
downloadwebrtc-dd33e63378a5ccb134bb52f935f67cd58c904e98.tar.gz
Translate isolated-script-test-output to dump_json_test_results in gtest-parallel-wrapper.py
BUG=chromium:325726 R=kjellander@webrtc.org NOTRY=True Review-Url: https://codereview.webrtc.org/2558783002 Cr-Commit-Position: refs/heads/master@{#15463}
Diffstat (limited to 'third_party')
-rwxr-xr-xthird_party/gtest-parallel/gtest-parallel-wrapper.py63
1 files changed, 59 insertions, 4 deletions
diff --git a/third_party/gtest-parallel/gtest-parallel-wrapper.py b/third_party/gtest-parallel/gtest-parallel-wrapper.py
index 1d8bcac713..1884ba04e7 100755
--- a/third_party/gtest-parallel/gtest-parallel-wrapper.py
+++ b/third_party/gtest-parallel/gtest-parallel-wrapper.py
@@ -8,6 +8,36 @@
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
+"""
+This script acts as an interface between the Chromium infrastructure and
+gtest-parallel, renaming options and translating environment variables into
+flags. Developers should execute gtest-parallel directly.
+
+In particular, this translates the GTEST_SHARD_INDEX and GTEST_TOTAL_SHARDS
+environment variables to the --shard_index and --shard_count flags, and renames
+the --isolated-script-test-output flag to --dump_json_test_results.
+
+Note that the flags unprocessed by this script will passed as arguments to the
+test executable, i.e.
+
+ gtest-parallel-wrapper.py some_test \
+ --isolated-script-test-output=some_dir \
+ --unprocessed_arg_1
+ -- \
+ --unprocessed_arg_2
+
+will be converted into
+
+ python gtest-parallel some_test \
+ --shard_count 1 \
+ --shard_index 0 \
+ --dump_json_test_results some_dir \
+ -- \
+ --unprocessed_arg_1
+ --unprocessed_arg_2
+"""
+
+import argparse
import os
import subprocess
import sys
@@ -22,14 +52,39 @@ gtest_total_shards = test_env.pop('GTEST_TOTAL_SHARDS', '1')
gtest_parallel_path = os.path.dirname(os.path.abspath(__file__))
gtest_parallel_path = os.path.join(gtest_parallel_path, 'gtest-parallel')
-command = [
- sys.executable,
- gtest_parallel_path,
+# Ignore '--'. Options unprocessed by this script will be passed to the test as
+# arguments.
+if '--' in sys.argv:
+ del sys.argv[sys.argv.index('--')]
+
+parser = argparse.ArgumentParser()
+parser.add_argument('--isolated-script-test-output', type=str, default=None)
+
+options, unprocessed = parser.parse_known_args()
+test_executable = unprocessed[0]
+test_arguments = unprocessed[1:]
+
+gtest_args = [
+ test_executable,
'--shard_count',
gtest_total_shards,
'--shard_index',
gtest_shard_index,
-] + sys.argv[1:]
+]
+
+# --isolated-script-test-output is used to upload results to the flakiness
+# dashboard. This translation is made because gtest-parallel expects the flag to
+# be called --dump_json_test_results instead.
+if options.isolated_script_test_output:
+ gtest_args += [
+ '--dump_json_test_results',
+ options.isolated_script_test_output,
+ ]
+
+command = [
+ sys.executable,
+ gtest_parallel_path,
+] + gtest_args + ['--'] + test_arguments
print 'gtest-parallel-wrapper: Executing command %s' % ' '.join(command)
sys.stdout.flush()