MB: Add a way to run tests on swarming without using gtest-parallel.
Adds a new test_type 'raw' to run tests on swarming without wrapping it
on gtest-parallel.
This will be used to run webrtc_perf_tests directly.
Bug: chromium:755660
Change-Id: I8558faadf242d1db1ad3e13083941886c92b1bd9
Reviewed-on: https://webrtc-review.googlesource.com/49360
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Edward Lemur <ehmaldonado@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21962}
diff --git a/tools_webrtc/mb/mb.py b/tools_webrtc/mb/mb.py
index 682532e..4db1bc3 100755
--- a/tools_webrtc/mb/mb.py
+++ b/tools_webrtc/mb/mb.py
@@ -1042,7 +1042,7 @@
self.WriteFailureAndRaise('We should not be isolating %s.' % target,
output_path=None)
if test_type not in ('console_test_launcher', 'windowed_test_launcher',
- 'non_parallel_console_test_launcher',
+ 'non_parallel_console_test_launcher', 'raw',
'additional_compile_target', 'junit_test', 'script'):
self.WriteFailureAndRaise('No command line for %s found (test type %s).'
% (target, test_type), output_path=None)
@@ -1071,21 +1071,23 @@
'../../testing/xvfb.py',
]
- # Memcheck is only supported for linux. Ignore in other platforms.
- memcheck = is_linux and 'rtc_use_memcheck=true' in vals['gn_args']
- memcheck_cmdline = [
- 'bash',
- '../../tools_webrtc/valgrind/webrtc_tests.sh',
- '--tool',
- 'memcheck',
- '--target',
- 'Release',
- '--build-dir',
- '..',
- '--test',
- ]
+ cmdline = (['../../testing/xvfb.py'] if xvfb else
+ ['../../testing/test_env.py'])
- if not memcheck:
+ # Memcheck is only supported for linux. Ignore in other platforms.
+ if is_linux and 'rtc_use_memcheck=true' in vals['gn_args']:
+ cmdline += [
+ 'bash',
+ '../../tools_webrtc/valgrind/webrtc_tests.sh',
+ '--tool',
+ 'memcheck',
+ '--target',
+ 'Release',
+ '--build-dir',
+ '..',
+ '--test',
+ ]
+ elif test_type != 'raw':
extra_files += [
'../../third_party/gtest-parallel/gtest-parallel',
'../../third_party/gtest-parallel/gtest_parallel.py',
@@ -1094,7 +1096,7 @@
sep = '\\' if self.platform == 'win32' else '/'
output_dir = '${ISOLATED_OUTDIR}' + sep + 'test_logs'
timeout = isolate_map[target].get('timeout', 900)
- gtest_parallel_wrapper = [
+ cmdline += [
'../../tools_webrtc/gtest-parallel-wrapper.py',
'--output_dir=%s' % output_dir,
'--gtest_color=no',
@@ -1104,27 +1106,25 @@
'--timeout=%s' % timeout,
'--retry_failed=3',
]
+ if test_type == 'non_parallel_console_test_launcher':
+ # Still use the gtest-parallel-wrapper.py script since we need it to
+ # run tests on swarming, but don't execute tests in parallel.
+ cmdline.append('--workers=1')
+
+ executable_prefix = '.\\' if self.platform == 'win32' else './'
+ executable_suffix = '.exe' if self.platform == 'win32' else ''
+ executable = executable_prefix + target + executable_suffix
+
+ cmdline.append(executable)
+ if test_type != 'raw':
+ cmdline.append('--')
asan = 'is_asan=true' in vals['gn_args']
lsan = 'is_lsan=true' in vals['gn_args']
msan = 'is_msan=true' in vals['gn_args']
tsan = 'is_tsan=true' in vals['gn_args']
- executable_prefix = '.\\' if self.platform == 'win32' else './'
- executable_suffix = '.exe' if self.platform == 'win32' else ''
- executable = executable_prefix + target + executable_suffix
-
- cmdline = (['../../testing/xvfb.py'] if xvfb else
- ['../../testing/test_env.py'])
- cmdline += memcheck_cmdline if memcheck else gtest_parallel_wrapper
- cmdline.append(executable)
- if test_type == 'non_parallel_console_test_launcher' and not memcheck:
- # Still use the gtest-parallel-wrapper.py script since we need it to
- # run tests on swarming, but don't execute tests in parallel.
- cmdline.append('--workers=1')
-
cmdline.extend([
- '--',
'--asan=%d' % asan,
'--lsan=%d' % lsan,
'--msan=%d' % msan,
diff --git a/tools_webrtc/mb/mb_unittest.py b/tools_webrtc/mb/mb_unittest.py
index dd47531..7c1f1e6 100755
--- a/tools_webrtc/mb/mb_unittest.py
+++ b/tools_webrtc/mb/mb_unittest.py
@@ -457,8 +457,8 @@
'--gtest_color=no',
'--timeout=500',
'--retry_failed=3',
- './base_unittests',
'--workers=1',
+ './base_unittests',
'--',
'--asan=0',
'--lsan=0',
@@ -501,6 +501,43 @@
'../../base/base_unittests_script.py',
])
+ def test_gn_gen_raw(self):
+ test_files = {
+ '/tmp/swarming_targets': 'base_unittests\n',
+ '/fake_src/testing/buildbot/gn_isolate_map.pyl': (
+ "{'base_unittests': {"
+ " 'label': '//base:base_unittests',"
+ " 'type': 'raw',"
+ "}}\n"
+ ),
+ '/fake_src/out/Default/base_unittests.runtime_deps': (
+ "base_unittests\n"
+ ),
+ }
+ mbw = self.check(['gen', '-c', 'gn_debug_goma', '//out/Default',
+ '--swarming-targets-file', '/tmp/swarming_targets',
+ '--isolate-map-file',
+ '/fake_src/testing/buildbot/gn_isolate_map.pyl'],
+ files=test_files, ret=0)
+
+ isolate_file = mbw.files['/fake_src/out/Default/base_unittests.isolate']
+ isolate_file_contents = ast.literal_eval(isolate_file)
+ files = isolate_file_contents['variables']['files']
+ command = isolate_file_contents['variables']['command']
+
+ self.assertEqual(files, [
+ '../../testing/test_env.py',
+ 'base_unittests',
+ ])
+ self.assertEqual(command, [
+ '../../testing/test_env.py',
+ './base_unittests',
+ '--asan=0',
+ '--lsan=0',
+ '--msan=0',
+ '--tsan=0',
+ ])
+
def test_gn_gen_non_parallel_console_test_launcher(self):
test_files = {
'/tmp/swarming_targets': 'base_unittests\n',
@@ -539,8 +576,8 @@
'--gtest_color=no',
'--timeout=900',
'--retry_failed=3',
- './base_unittests',
'--workers=1',
+ './base_unittests',
'--',
'--asan=0',
'--lsan=0',