From beffdd4c6a8196fe8e61236c6453d3fb48986252 Mon Sep 17 00:00:00 2001 From: Edward Lemur Date: Wed, 27 Sep 2017 13:07:47 +0200 Subject: [PATCH] MB: Make it possible to specify timeout. webrtc_perf_tests needs more than 15 min to run. NOTRY=True Bug: chromium:755660 Change-Id: Ibabfae3679206105d585c35f80b839f0046f9ccc Reviewed-on: https://webrtc-review.googlesource.com/4021 Reviewed-by: Henrik Kjellander Commit-Queue: Edward Lemur Cr-Commit-Position: refs/heads/master@{#19996} --- tools_webrtc/mb/gn_isolate_map.pyl | 1 + tools_webrtc/mb/mb.py | 3 +- tools_webrtc/mb/mb_unittest.py | 48 ++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/tools_webrtc/mb/gn_isolate_map.pyl b/tools_webrtc/mb/gn_isolate_map.pyl index 45328479ea..09314a9d89 100644 --- a/tools_webrtc/mb/gn_isolate_map.pyl +++ b/tools_webrtc/mb/gn_isolate_map.pyl @@ -120,6 +120,7 @@ }, "webrtc_perf_tests": { "label": "//:webrtc_perf_tests", + "timeout": 3600, # 1 hour "type": "non_parallel_console_test_launcher", }, } diff --git a/tools_webrtc/mb/mb.py b/tools_webrtc/mb/mb.py index 8e57d39cb5..2cd54f2a76 100755 --- a/tools_webrtc/mb/mb.py +++ b/tools_webrtc/mb/mb.py @@ -1098,6 +1098,7 @@ class MetaBuildWrapper(object): ] sep = '\\' if self.platform == 'win32' else '/' output_dir = '${ISOLATED_OUTDIR}' + sep + 'test_logs' + timeout = isolate_map[target].get('timeout', 900) gtest_parallel_wrapper = [ '../../tools_webrtc/gtest-parallel-wrapper.py', '--output_dir=%s' % output_dir, @@ -1105,7 +1106,7 @@ class MetaBuildWrapper(object): # We tell gtest-parallel to interrupt the test after 900 seconds, # so it can exit cleanly and report results, instead of being # interrupted by swarming and not reporting anything. - '--timeout=900', + '--timeout=%s' % timeout, '--retry_failed=3', ] diff --git a/tools_webrtc/mb/mb_unittest.py b/tools_webrtc/mb/mb_unittest.py index e6518edb4d..312fee64ce 100755 --- a/tools_webrtc/mb/mb_unittest.py +++ b/tools_webrtc/mb/mb_unittest.py @@ -419,6 +419,54 @@ class UnitTest(unittest.TestCase): '--store-tombstones', ]) + def test_gn_gen_timeout(self): + test_files = { + '/tmp/swarming_targets': 'base_unittests\n', + '/fake_src/testing/buildbot/gn_isolate_map.pyl': ( + "{'base_unittests': {" + " 'label': '//base:base_unittests'," + " 'type': 'non_parallel_console_test_launcher'," + " 'timeout': 500," + "}}\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', + '../../third_party/gtest-parallel/gtest-parallel', + '../../third_party/gtest-parallel/gtest_parallel.py', + '../../tools_webrtc/gtest-parallel-wrapper.py', + 'base_unittests', + ]) + self.assertEqual(command, [ + '../../testing/test_env.py', + '../../tools_webrtc/gtest-parallel-wrapper.py', + '--output_dir=${ISOLATED_OUTDIR}/test_logs', + '--gtest_color=no', + '--timeout=500', + '--retry_failed=3', + './base_unittests', + '--workers=1', + '--', + '--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',