Use Chromium's mirror of github for gtest-parallel.
- Move gtest-parallel-wrapper.py to tools-webrtc. - Update mb.py and mb_unittest.py BUG=webrtc:7391 NOTRY=True R=kjellander@webrtc.org Review-Url: https://codereview.webrtc.org/2785653002 Cr-Commit-Position: refs/heads/master@{#17453}
This commit is contained in:
2
DEPS
2
DEPS
@ -91,7 +91,7 @@ deps = {
|
||||
'src/third_party/gflags/src':
|
||||
Var('chromium_git') + '/external/github.com/gflags/gflags' + '@' + '03bebcb065c83beff83d50ae025a55a4bf94dfca',
|
||||
'src/third_party/gtest-parallel':
|
||||
Var('chromium_git') + '/external/webrtc/deps/third_party/gtest-parallel' + '@' + '1dad0e9f6d82ff994130b529d7d814b40eb32b0e',
|
||||
Var('chromium_git') + '/external/github.com/google/gtest-parallel' + '@' + 'f3c90adaadecab22e7f2591746b4d88747dd9a3e',
|
||||
}
|
||||
|
||||
deps_os = {
|
||||
|
||||
107
tools-webrtc/gtest-parallel-wrapper.py
Executable file
107
tools-webrtc/gtest-parallel-wrapper.py
Executable file
@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license
|
||||
# that can be found in the LICENSE file in the root of the source
|
||||
# tree. An additional intellectual property rights grant can be found
|
||||
# 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
|
||||
|
||||
# GTEST_SHARD_INDEX and GTEST_TOTAL_SHARDS must be removed from the environment
|
||||
# otherwise it will be picked up by the binary, causing a bug where only tests
|
||||
# in the firsh shard are executed.
|
||||
test_env = os.environ.copy()
|
||||
gtest_shard_index = test_env.pop('GTEST_SHARD_INDEX', '0')
|
||||
gtest_total_shards = test_env.pop('GTEST_TOTAL_SHARDS', '1')
|
||||
|
||||
webrtc_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
gtest_parallel_path = os.path.join(webrtc_root, 'third_party', 'gtest-parallel',
|
||||
'gtest-parallel')
|
||||
|
||||
# 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)
|
||||
parser.add_argument('--output_dir', type=str, default=None)
|
||||
parser.add_argument('--timeout', type=int, 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,
|
||||
]
|
||||
|
||||
# --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,
|
||||
]
|
||||
|
||||
if options.output_dir:
|
||||
gtest_args += [
|
||||
'--output_dir',
|
||||
options.output_dir,
|
||||
]
|
||||
|
||||
if options.timeout:
|
||||
gtest_args += [
|
||||
'--timeout',
|
||||
str(options.timeout),
|
||||
]
|
||||
|
||||
command = [
|
||||
sys.executable,
|
||||
gtest_parallel_path,
|
||||
] + gtest_args + ['--'] + test_arguments
|
||||
|
||||
print 'gtest-parallel-wrapper: Executing command %s' % ' '.join(command)
|
||||
sys.stdout.flush()
|
||||
|
||||
sys.exit(subprocess.call(command, env=test_env, cwd=os.getcwd()))
|
||||
@ -1092,12 +1092,12 @@ class MetaBuildWrapper(object):
|
||||
if gtest_parallel:
|
||||
extra_files += [
|
||||
'../../third_party/gtest-parallel/gtest-parallel',
|
||||
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||
'../../tools-webrtc/gtest-parallel-wrapper.py',
|
||||
]
|
||||
sep = '\\' if self.platform == 'win32' else '/'
|
||||
output_dir = '${ISOLATED_OUTDIR}' + sep + 'test_logs'
|
||||
gtest_parallel_wrapper = [
|
||||
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||
'../../tools-webrtc/gtest-parallel-wrapper.py',
|
||||
'--output_dir=%s' % output_dir,
|
||||
]
|
||||
|
||||
|
||||
@ -481,13 +481,13 @@ class UnitTest(unittest.TestCase):
|
||||
'../../testing/test_env.py',
|
||||
'../../testing/xvfb.py',
|
||||
'../../third_party/gtest-parallel/gtest-parallel',
|
||||
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||
'../../tools-webrtc/gtest-parallel-wrapper.py',
|
||||
'base_unittests',
|
||||
'some_resource_file',
|
||||
])
|
||||
self.assertEqual(command, [
|
||||
'../../testing/xvfb.py',
|
||||
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||
'../../tools-webrtc/gtest-parallel-wrapper.py',
|
||||
'--output_dir=${ISOLATED_OUTDIR}/test_logs',
|
||||
'./base_unittests',
|
||||
'--',
|
||||
@ -526,13 +526,13 @@ class UnitTest(unittest.TestCase):
|
||||
self.assertEqual(files, [
|
||||
'../../testing/test_env.py',
|
||||
'../../third_party/gtest-parallel/gtest-parallel',
|
||||
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||
'../../tools-webrtc/gtest-parallel-wrapper.py',
|
||||
'some_dependency',
|
||||
'unittests.exe',
|
||||
])
|
||||
self.assertEqual(command, [
|
||||
'../../testing/test_env.py',
|
||||
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||
'../../tools-webrtc/gtest-parallel-wrapper.py',
|
||||
'--output_dir=${ISOLATED_OUTDIR}\\test_logs',
|
||||
r'.\unittests.exe',
|
||||
'--',
|
||||
@ -568,12 +568,12 @@ class UnitTest(unittest.TestCase):
|
||||
self.assertEqual(files, [
|
||||
'../../testing/test_env.py',
|
||||
'../../third_party/gtest-parallel/gtest-parallel',
|
||||
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||
'../../tools-webrtc/gtest-parallel-wrapper.py',
|
||||
'base_unittests',
|
||||
])
|
||||
self.assertEqual(command, [
|
||||
'../../testing/test_env.py',
|
||||
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||
'../../tools-webrtc/gtest-parallel-wrapper.py',
|
||||
'--output_dir=${ISOLATED_OUTDIR}/test_logs',
|
||||
'./base_unittests',
|
||||
'--',
|
||||
|
||||
Reference in New Issue
Block a user