MB: Run test with gtest-parallel on swarming.
TBR=pbos@webrtc.org BUG=chromium:497757, chromium:664425 NOTRY=True Review-Url: https://codereview.webrtc.org/2503503002 Cr-Commit-Position: refs/heads/master@{#15093}
This commit is contained in:
parent
2a3eb9f367
commit
b2fcf6d96f
13
third_party/gtest-parallel/gtest-parallel
vendored
13
third_party/gtest-parallel/gtest-parallel
vendored
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2013 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -266,6 +266,15 @@ parser.add_option('--format', type='string', default='filter',
|
||||
help='output format (raw,filter)')
|
||||
parser.add_option('--print_test_times', action='store_true', default=False,
|
||||
help='When done, list the run time of each test')
|
||||
parser.add_option('--shard-count', type='int',
|
||||
default=int(os.environ.get('GTEST_TOTAL_SHARDS', 1)),
|
||||
help=('Total number of shards (for sharding test execution '
|
||||
'between multiple machines). Default: %default'))
|
||||
parser.add_option('--shard-index', type='int',
|
||||
default=int(os.environ.get('GTEST_SHARD_INDEX', 0)),
|
||||
help=('Zero-indexed number identifying this shard (for '
|
||||
'sharding test execution between multiple machines). '
|
||||
'Default: %default'))
|
||||
|
||||
(options, binaries) = parser.parse_args()
|
||||
|
||||
@ -321,6 +330,8 @@ for test_binary in binaries:
|
||||
tests.append((times.get_test_time(test_binary, test),
|
||||
test_binary, test, command))
|
||||
|
||||
tests = tests[options.shard_index::options.shard_count]
|
||||
|
||||
if options.failed:
|
||||
# The first element of each entry is the runtime of the most recent
|
||||
# run if it was successful, or None if the test is new or the most
|
||||
|
||||
@ -1077,9 +1077,17 @@ class MetaBuildWrapper(object):
|
||||
|
||||
executable = isolate_map[target].get('executable', target)
|
||||
executable_suffix = '.exe' if self.platform == 'win32' else ''
|
||||
executable_prefix = '.\\' if self.platform == 'win32' else './'
|
||||
|
||||
cmdline = []
|
||||
extra_files = []
|
||||
common_cmdline = [
|
||||
executable_prefix + str(executable) + executable_suffix,
|
||||
'--',
|
||||
'--asan=%d' % asan,
|
||||
'--msan=%d' % msan,
|
||||
'--tsan=%d' % tsan,
|
||||
]
|
||||
|
||||
if test_type == 'nontest':
|
||||
self.WriteFailureAndRaise('We should not be isolating %s.' % target,
|
||||
@ -1108,57 +1116,31 @@ class MetaBuildWrapper(object):
|
||||
'xdisplaycheck',
|
||||
'../../testing/test_env.py',
|
||||
'../../testing/xvfb.py',
|
||||
'../../third_party/gtest-parallel/gtest-parallel',
|
||||
]
|
||||
cmdline = [
|
||||
'../../testing/xvfb.py',
|
||||
'.',
|
||||
'./' + str(executable) + executable_suffix,
|
||||
'--brave-new-test-launcher',
|
||||
'--test-launcher-bot-mode',
|
||||
'--asan=%d' % asan,
|
||||
'--msan=%d' % msan,
|
||||
'--tsan=%d' % tsan,
|
||||
]
|
||||
'python',
|
||||
'../../third_party/gtest-parallel/gtest-parallel',
|
||||
] + common_cmdline
|
||||
elif test_type in ('windowed_test_launcher', 'console_test_launcher'):
|
||||
extra_files = [
|
||||
'../../testing/test_env.py'
|
||||
'../../testing/test_env.py',
|
||||
'../../third_party/gtest-parallel/gtest-parallel',
|
||||
]
|
||||
cmdline = [
|
||||
'../../testing/test_env.py',
|
||||
'./' + str(executable) + executable_suffix,
|
||||
'--brave-new-test-launcher',
|
||||
'--test-launcher-bot-mode',
|
||||
'--asan=%d' % asan,
|
||||
'--msan=%d' % msan,
|
||||
'--tsan=%d' % tsan,
|
||||
]
|
||||
elif test_type == 'gpu_browser_test':
|
||||
'python',
|
||||
'../../third_party/gtest-parallel/gtest-parallel',
|
||||
] + common_cmdline
|
||||
elif test_type == 'non_parallel_console_test_launcher':
|
||||
extra_files = [
|
||||
'../../testing/test_env.py'
|
||||
]
|
||||
gtest_filter = isolate_map[target]['gtest_filter']
|
||||
cmdline = [
|
||||
'../../testing/test_env.py',
|
||||
'./browser_tests' + executable_suffix,
|
||||
'--test-launcher-bot-mode',
|
||||
'--enable-gpu',
|
||||
'--test-launcher-jobs=1',
|
||||
'--gtest_filter=%s' % gtest_filter,
|
||||
]
|
||||
elif test_type == 'script':
|
||||
extra_files = [
|
||||
'../../testing/test_env.py'
|
||||
]
|
||||
cmdline = [
|
||||
'../../testing/test_env.py',
|
||||
'../../' + self.ToSrcRelPath(isolate_map[target]['script'])
|
||||
]
|
||||
elif test_type in ('raw'):
|
||||
extra_files = []
|
||||
cmdline = [
|
||||
'./' + str(target) + executable_suffix,
|
||||
]
|
||||
|
||||
] + common_cmdline
|
||||
else:
|
||||
self.WriteFailureAndRaise('No command line for %s found (test type %s).'
|
||||
% (target, test_type), output_path=None)
|
||||
|
||||
@ -346,38 +346,12 @@ class UnitTest(unittest.TestCase):
|
||||
self.check(['gen', '-c', 'gn_debug_goma', '//out/Default'], mbw=mbw, ret=1)
|
||||
|
||||
def test_gn_gen_swarming(self):
|
||||
files = {
|
||||
'/tmp/swarming_targets': 'base_unittests\n',
|
||||
'/fake_src/testing/buildbot/gn_isolate_map.pyl': (
|
||||
"{'base_unittests': {"
|
||||
" 'label': '//base:base_unittests',"
|
||||
" 'type': 'raw',"
|
||||
" 'args': [],"
|
||||
"}}\n"
|
||||
),
|
||||
'/fake_src/out/Default/base_unittests.runtime_deps': (
|
||||
"base_unittests\n"
|
||||
),
|
||||
}
|
||||
mbw = self.fake_mbw(files)
|
||||
self.check(['gen',
|
||||
'-c', 'gn_debug_goma',
|
||||
'--swarming-targets-file', '/tmp/swarming_targets',
|
||||
'//out/Default'], mbw=mbw, ret=0)
|
||||
self.assertIn('/fake_src/out/Default/base_unittests.isolate',
|
||||
mbw.files)
|
||||
self.assertIn('/fake_src/out/Default/base_unittests.isolated.gen.json',
|
||||
mbw.files)
|
||||
|
||||
def test_gn_gen_swarming_script(self):
|
||||
files = {
|
||||
'/tmp/swarming_targets': 'cc_perftests\n',
|
||||
'/fake_src/testing/buildbot/gn_isolate_map.pyl': (
|
||||
"{'cc_perftests': {"
|
||||
" 'label': '//cc:cc_perftests',"
|
||||
" 'type': 'script',"
|
||||
" 'script': '/fake_src/out/Default/test_script.py',"
|
||||
" 'args': [],"
|
||||
" 'type': 'console_test_launcher',"
|
||||
"}}\n"
|
||||
),
|
||||
'c:\\fake_src\out\Default\cc_perftests.exe.runtime_deps': (
|
||||
@ -403,7 +377,7 @@ class UnitTest(unittest.TestCase):
|
||||
'/fake_src/testing/buildbot/gn_isolate_map.pyl': (
|
||||
"{'base_unittests': {"
|
||||
" 'label': '//base:base_unittests',"
|
||||
" 'type': 'raw',"
|
||||
" 'type': 'non_parallel_console_test_launcher',"
|
||||
" 'args': [],"
|
||||
"}}\n"
|
||||
),
|
||||
@ -428,7 +402,7 @@ class UnitTest(unittest.TestCase):
|
||||
'/fake_src/testing/buildbot/gn_isolate_map.pyl': (
|
||||
"{'base_unittests': {"
|
||||
" 'label': '//base:base_unittests',"
|
||||
" 'type': 'raw',"
|
||||
" 'type': 'windowed_test_launcher',"
|
||||
" 'args': [],"
|
||||
"}}\n"
|
||||
),
|
||||
|
||||
@ -93,7 +93,7 @@
|
||||
},
|
||||
"webrtc_nonparallel_tests": {
|
||||
"label": "//webrtc:webrtc_nonparallel_tests",
|
||||
"type": "console_test_launcher",
|
||||
"type": "non_parallel_console_test_launcher",
|
||||
},
|
||||
"xmllite_xmpp_unittests": {
|
||||
"label": "//webrtc/libjingle:xmllite_xmpp_unittests",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user