Update gtest-parallel and introduce gtest-parallel-wrapper.
Now gtest-parallel is the same as in the github repo. A wrapper script was created to handle the environment variables. TBR=pbos@webrtc.org BUG=chromium:497757 NOTRY=True Review-Url: https://codereview.webrtc.org/2513073002 Cr-Commit-Position: refs/heads/master@{#15170}
This commit is contained in:
parent
de609b26c5
commit
ab102f1632
8
third_party/gtest-parallel/README.webrtc
vendored
8
third_party/gtest-parallel/README.webrtc
vendored
@ -1,9 +1,13 @@
|
|||||||
URL: https://github.com/google/gtest-parallel
|
URL: https://github.com/google/gtest-parallel
|
||||||
Version: d0cebaba01c5dbf3af8a1c89b64eed7596c2b56c
|
Version: 89b859c1412089468599a3366a72a1e774ce5c2c
|
||||||
License: Apache 2.0
|
License: Apache 2.0
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Parallelization script for gtest binaries.
|
Parallelization script for gtest binaries.
|
||||||
|
|
||||||
Local Modifications: None
|
Local Modifications:
|
||||||
|
Added gtest-parallel-wrapper.py to convert the GTEST_SHARD_INDEX and
|
||||||
|
GTEST_TOTAL_SHARDS environment variables to flags, since gtest-parallel takes
|
||||||
|
flags as arguments, and delete them afterwards, since letting them set
|
||||||
|
introduces a bug where only tests in the first shard are executed.
|
||||||
|
|||||||
27
third_party/gtest-parallel/gtest-parallel
vendored
27
third_party/gtest-parallel/gtest-parallel
vendored
@ -265,16 +265,13 @@ parser.add_option('--gtest_also_run_disabled_tests', action='store_true',
|
|||||||
parser.add_option('--format', type='string', default='filter',
|
parser.add_option('--format', type='string', default='filter',
|
||||||
help='output format (raw,filter)')
|
help='output format (raw,filter)')
|
||||||
parser.add_option('--print_test_times', action='store_true', default=False,
|
parser.add_option('--print_test_times', action='store_true', default=False,
|
||||||
help='When done, list the run time of each test')
|
help='list the run time of each test at the end of execution')
|
||||||
parser.add_option('--shard_count', type='int',
|
parser.add_option('--shard_count', type='int', default=1,
|
||||||
default=int(os.environ.pop('GTEST_TOTAL_SHARDS', 1)),
|
help='total number of shards (for sharding test execution '
|
||||||
help=('Total number of shards (for sharding test execution '
|
'between multiple machines)')
|
||||||
'between multiple machines). Default: %default'))
|
parser.add_option('--shard_index', type='int', default=0,
|
||||||
parser.add_option('--shard_index', type='int',
|
help='zero-indexed number identifying this shard (for '
|
||||||
default=int(os.environ.pop('GTEST_SHARD_INDEX', 0)),
|
'sharding test execution between multiple machines)')
|
||||||
help=('Zero-indexed number identifying this shard (for '
|
|
||||||
'sharding test execution between multiple machines). '
|
|
||||||
'Default: %default'))
|
|
||||||
|
|
||||||
(options, binaries) = parser.parse_args()
|
(options, binaries) = parser.parse_args()
|
||||||
|
|
||||||
@ -288,16 +285,16 @@ if options.format == 'raw':
|
|||||||
elif options.format == 'filter':
|
elif options.format == 'filter':
|
||||||
logger = FilterFormat()
|
logger = FilterFormat()
|
||||||
else:
|
else:
|
||||||
sys.exit("Unknown output format: " + options.format)
|
parser.error("Unknown output format: " + options.format)
|
||||||
|
|
||||||
if options.shard_count < 1:
|
if options.shard_count < 1:
|
||||||
sys.exit("Invalid number of shards: %d. Must be at least 1." %
|
parser.error("Invalid number of shards: %d. Must be at least 1." %
|
||||||
options.shard_count)
|
options.shard_count)
|
||||||
if options.shard_index < 0 or options.shard_count <= options.shard_index:
|
if not (0 <= options.shard_index < options.shard_count):
|
||||||
sys.exit("Invalid shard index: %d. Must be between 0 and %d." %
|
parser.error("Invalid shard index: %d. Must be between 0 and %d "
|
||||||
|
"(less than the number of shards)." %
|
||||||
(options.shard_index, options.shard_count - 1))
|
(options.shard_index, options.shard_count - 1))
|
||||||
|
|
||||||
|
|
||||||
# Find tests.
|
# Find tests.
|
||||||
save_file = os.path.join(os.path.expanduser("~"), ".gtest-parallel-times")
|
save_file = os.path.join(os.path.expanduser("~"), ".gtest-parallel-times")
|
||||||
times = TestTimes(save_file)
|
times = TestTimes(save_file)
|
||||||
|
|||||||
37
third_party/gtest-parallel/gtest-parallel-wrapper.py
vendored
Executable file
37
third_party/gtest-parallel/gtest-parallel-wrapper.py
vendored
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#!/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.
|
||||||
|
|
||||||
|
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')
|
||||||
|
|
||||||
|
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,
|
||||||
|
'--shard_count',
|
||||||
|
gtest_total_shards,
|
||||||
|
'--shard_index',
|
||||||
|
gtest_shard_index,
|
||||||
|
] + sys.argv[1:]
|
||||||
|
|
||||||
|
print 'gtest-parallel-wrapper: Executing command %s' % ' '.join(command)
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
sys.exit(subprocess.call(command, env=test_env, cwd=os.getcwd()))
|
||||||
@ -1117,22 +1117,22 @@ class MetaBuildWrapper(object):
|
|||||||
'../../testing/test_env.py',
|
'../../testing/test_env.py',
|
||||||
'../../testing/xvfb.py',
|
'../../testing/xvfb.py',
|
||||||
'../../third_party/gtest-parallel/gtest-parallel',
|
'../../third_party/gtest-parallel/gtest-parallel',
|
||||||
|
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||||
]
|
]
|
||||||
cmdline = [
|
cmdline = [
|
||||||
'../../testing/xvfb.py',
|
'../../testing/xvfb.py',
|
||||||
'.',
|
'.',
|
||||||
'python',
|
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||||
'../../third_party/gtest-parallel/gtest-parallel',
|
|
||||||
] + common_cmdline
|
] + common_cmdline
|
||||||
elif test_type in ('windowed_test_launcher', 'console_test_launcher'):
|
elif test_type in ('windowed_test_launcher', 'console_test_launcher'):
|
||||||
extra_files = [
|
extra_files = [
|
||||||
'../../testing/test_env.py',
|
'../../testing/test_env.py',
|
||||||
'../../third_party/gtest-parallel/gtest-parallel',
|
'../../third_party/gtest-parallel/gtest-parallel',
|
||||||
|
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||||
]
|
]
|
||||||
cmdline = [
|
cmdline = [
|
||||||
'../../testing/test_env.py',
|
'../../testing/test_env.py',
|
||||||
'python',
|
'../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
|
||||||
'../../third_party/gtest-parallel/gtest-parallel',
|
|
||||||
] + common_cmdline
|
] + common_cmdline
|
||||||
elif test_type == 'non_parallel_console_test_launcher':
|
elif test_type == 'non_parallel_console_test_launcher':
|
||||||
extra_files = [
|
extra_files = [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user