OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Recipe for building and running tests for WebRTC stand-alone. | 5 # Recipe for building and running tests for WebRTC stand-alone. |
6 | 6 |
7 DEPS = [ | 7 DEPS = [ |
| 8 'archive', |
8 'chromium', | 9 'chromium', |
| 10 'chromium_android', |
9 'gclient', | 11 'gclient', |
10 'path', | 12 'path', |
11 'platform', | 13 'platform', |
12 'properties', | 14 'properties', |
13 'step', | 15 'step', |
14 'tryserver', | 16 'tryserver', |
15 'webrtc', | 17 'webrtc', |
16 ] | 18 ] |
17 | 19 |
18 | 20 |
19 def GenSteps(api): | 21 def GenSteps(api): |
20 mastername = api.properties.get('mastername') | 22 mastername = api.properties.get('mastername') |
21 buildername = api.properties.get('buildername') | 23 buildername = api.properties.get('buildername') |
22 master_dict = api.webrtc.BUILDERS.get(mastername, {}) | 24 master_dict = api.webrtc.BUILDERS.get(mastername, {}) |
23 master_settings = master_dict.get('settings', {}) | 25 master_settings = master_dict.get('settings', {}) |
24 bot_config = master_dict.get('builders', {}).get(buildername) | 26 bot_config = master_dict.get('builders', {}).get(buildername) |
25 bot_type = bot_config.get('bot_type', 'builder_tester') | |
26 assert bot_config, ('Unrecognized builder name "%r" for master "%r".' % | 27 assert bot_config, ('Unrecognized builder name "%r" for master "%r".' % |
27 (buildername, mastername)) | 28 (buildername, mastername)) |
| 29 bot_type = bot_config.get('bot_type', 'builder_tester') |
| 30 does_build = bot_type in ('builder', 'builder_tester') |
| 31 does_test = bot_type in ('builder_tester', 'tester') |
| 32 |
28 recipe_config_name = bot_config['recipe_config'] | 33 recipe_config_name = bot_config['recipe_config'] |
29 recipe_config = api.webrtc.RECIPE_CONFIGS.get(recipe_config_name) | 34 recipe_config = api.webrtc.RECIPE_CONFIGS.get(recipe_config_name) |
30 assert recipe_config, ('Cannot find recipe_config "%s" for builder "%r".' % | 35 assert recipe_config, ('Cannot find recipe_config "%s" for builder "%r".' % |
31 (recipe_config_name, buildername)) | 36 (recipe_config_name, buildername)) |
32 | 37 |
33 api.webrtc.set_config(recipe_config['webrtc_config'], | 38 api.webrtc.set_config(recipe_config['webrtc_config'], |
34 PERF_CONFIG=master_settings.get('PERF_CONFIG'), | 39 PERF_CONFIG=master_settings.get('PERF_CONFIG'), |
35 **bot_config.get('webrtc_config_kwargs', {})) | 40 **bot_config.get('webrtc_config_kwargs', {})) |
36 for c in bot_config.get('gclient_apply_config', []): | 41 for c in bot_config.get('gclient_apply_config', []): |
37 api.gclient.apply_config(c) | 42 api.gclient.apply_config(c) |
38 for c in bot_config.get('chromium_apply_config', []): | 43 for c in bot_config.get('chromium_apply_config', []): |
39 api.chromium.apply_config(c) | 44 api.chromium.apply_config(c) |
40 | 45 |
41 # Needed for the multiple webcam check steps to get unique names. | 46 # Needed for the multiple webcam check steps to get unique names. |
42 api.step.auto_resolve_conflicts = True | 47 api.step.auto_resolve_conflicts = True |
43 | 48 |
44 if api.tryserver.is_tryserver: | 49 if api.tryserver.is_tryserver: |
45 api.chromium.apply_config('trybot_flavor') | 50 api.chromium.apply_config('trybot_flavor') |
46 | 51 |
47 step_result = api.gclient.checkout() | 52 step_result = api.gclient.checkout() |
48 # Whatever step is run right before this line needs to emit got_revision. | 53 # Whatever step is run right before this line needs to emit got_revision. |
49 got_revision = step_result.presentation.properties['got_revision'] | 54 got_revision = step_result.presentation.properties['got_revision'] |
50 | 55 |
51 if api.tryserver.is_tryserver: | 56 if api.tryserver.is_tryserver: |
52 api.tryserver.maybe_apply_issue() | 57 api.tryserver.maybe_apply_issue() |
53 | 58 |
54 api.chromium.runhooks() | 59 api.chromium.runhooks() |
55 | 60 |
56 if api.chromium.c.project_generator.tool == 'gn': | 61 if does_build: |
57 api.chromium.run_gn() | 62 if api.chromium.c.project_generator.tool == 'gn': |
58 api.chromium.compile(targets=['all']) | 63 api.chromium.run_gn() |
59 else: | 64 api.chromium.compile(targets=['all']) |
60 api.chromium.compile() | 65 else: |
| 66 api.chromium.compile() |
61 | 67 |
62 if api.chromium.c.gyp_env.GYP_DEFINES.get('syzyasan', 0) == 1: | 68 if api.chromium.c.gyp_env.GYP_DEFINES.get('syzyasan', 0) == 1: |
63 api.chromium.apply_syzyasan() | 69 api.chromium.apply_syzyasan() |
64 | 70 |
65 if bot_type in ('builder_tester', 'tester'): | 71 archive_revision = api.properties.get('parent_got_revision', got_revision) |
| 72 if bot_type == 'builder' and bot_config.get('build_gs_archive'): |
| 73 api.webrtc.package_build( |
| 74 api.webrtc.GS_ARCHIVES[bot_config['build_gs_archive']], |
| 75 archive_revision) |
| 76 |
| 77 if bot_type == 'tester': |
| 78 api.webrtc.extract_build( |
| 79 api.webrtc.GS_ARCHIVES[bot_config['build_gs_archive']], |
| 80 archive_revision) |
| 81 |
| 82 if does_test: |
66 api.webrtc.cleanup() | 83 api.webrtc.cleanup() |
67 test_suite = recipe_config.get('test_suite') | 84 test_suite = recipe_config.get('test_suite') |
68 if test_suite: | 85 if test_suite: |
69 api.webrtc.runtests(test_suite, got_revision) | 86 api.webrtc.runtests(test_suite, got_revision) |
70 | 87 |
| 88 |
71 def _sanitize_nonalpha(text): | 89 def _sanitize_nonalpha(text): |
72 return ''.join(c if c.isalnum() else '_' for c in text.lower()) | 90 return ''.join(c if c.isalnum() else '_' for c in text.lower()) |
73 | 91 |
74 | 92 |
75 def GenTests(api): | 93 def GenTests(api): |
76 def generate_builder(mastername, buildername, bot_config, revision, | 94 builders = api.webrtc.BUILDERS |
77 legacy_trybot=False, suffix=None): | 95 |
| 96 def generate_builder(mastername, buildername, revision, |
| 97 parent_got_revision=None, legacy_trybot=False, |
| 98 suffix=None): |
78 suffix = suffix or '' | 99 suffix = suffix or '' |
| 100 bot_config = builders[mastername]['builders'][buildername] |
79 bot_type = bot_config.get('bot_type', 'builder_tester') | 101 bot_type = bot_config.get('bot_type', 'builder_tester') |
| 102 |
80 if bot_type in ('builder', 'builder_tester'): | 103 if bot_type in ('builder', 'builder_tester'): |
81 assert bot_config.get('parent_buildername') is None, ( | 104 assert bot_config.get('parent_buildername') is None, ( |
82 'Unexpected parent_buildername for builder %r on master %r.' % | 105 'Unexpected parent_buildername for builder %r on master %r.' % |
83 (buildername, mastername)) | 106 (buildername, mastername)) |
84 | 107 |
85 webrtc_config_kwargs = bot_config.get('webrtc_config_kwargs', {}) | 108 webrtc_kwargs = bot_config.get('webrtc_config_kwargs', {}) |
86 test = ( | 109 test = ( |
87 api.test('%s_%s%s' % (_sanitize_nonalpha(mastername), | 110 api.test('%s_%s%s' % (_sanitize_nonalpha(mastername), |
88 _sanitize_nonalpha(buildername), suffix)) + | 111 _sanitize_nonalpha(buildername), suffix)) + |
89 api.properties(mastername=mastername, | 112 api.properties(mastername=mastername, |
90 buildername=buildername, | 113 buildername=buildername, |
91 slavename='slavename', | 114 slavename='slavename', |
92 BUILD_CONFIG=webrtc_config_kwargs['BUILD_CONFIG']) + | 115 BUILD_CONFIG=webrtc_kwargs['BUILD_CONFIG']) + |
93 api.platform(bot_config['testing']['platform'], | 116 api.platform(bot_config['testing']['platform'], |
94 webrtc_config_kwargs.get('TARGET_BITS', 64)) | 117 webrtc_kwargs.get('TARGET_BITS', 64)) |
95 ) | 118 ) |
| 119 |
| 120 if bot_config.get('parent_buildername'): |
| 121 test += api.properties( |
| 122 parent_buildername=bot_config['parent_buildername']) |
| 123 |
96 if revision: | 124 if revision: |
97 test += api.properties(revision=revision) | 125 test += api.properties(revision=revision) |
| 126 if bot_type == 'tester': |
| 127 parent_rev = parent_got_revision or revision |
| 128 test += api.properties(parent_got_revision=parent_rev) |
| 129 |
98 if mastername.startswith('tryserver'): | 130 if mastername.startswith('tryserver'): |
99 if legacy_trybot: | 131 if legacy_trybot: |
100 test += api.properties(patch_url='try_job_svn_patch') | 132 test += api.properties(patch_url='try_job_svn_patch') |
101 else: | 133 else: |
102 test += api.properties(issue=666666, patchset=1, | 134 test += api.properties(issue=666666, patchset=1, |
103 rietveld='https://fake.rietveld.url') | 135 rietveld='https://fake.rietveld.url') |
104 return test | 136 return test |
105 | 137 |
106 for mastername in ('client.webrtc', 'client.webrtc.fyi', 'tryserver.webrtc'): | 138 for mastername in ('client.webrtc', 'client.webrtc.fyi', 'tryserver.webrtc'): |
107 master_config = api.webrtc.BUILDERS[mastername] | 139 master_config = builders[mastername] |
108 for buildername, bot_config in master_config['builders'].iteritems(): | 140 for buildername in master_config['builders'].keys(): |
109 if bot_config['recipe_config'] == 'webrtc_android_apk': | 141 yield generate_builder(mastername, buildername, revision='12345') |
110 continue | |
111 yield generate_builder(mastername, buildername, bot_config, | |
112 revision='12345') | |
113 | 142 |
114 # Forced build (not specifying any revision). | 143 # Forced build (not specifying any revision). |
115 mastername = 'client.webrtc' | 144 mastername = 'client.webrtc' |
116 buildername = 'Linux64 Debug' | 145 buildername = 'Linux64 Debug' |
117 bot_config = api.webrtc.BUILDERS[mastername]['builders'][buildername] | 146 yield generate_builder(mastername, buildername, revision=None, |
118 yield generate_builder(mastername, buildername, bot_config, revision=None, | |
119 suffix='_forced') | 147 suffix='_forced') |
120 | 148 |
| 149 buildername = 'Android Builder' |
| 150 yield generate_builder(mastername, buildername, revision=None, |
| 151 suffix='_forced') |
| 152 |
| 153 buildername = 'Android Tests (KK Nexus5)' |
| 154 yield generate_builder(mastername, buildername, revision=None, |
| 155 parent_got_revision='12345', suffix='_forced') |
| 156 yield generate_builder(mastername, buildername, revision=None, |
| 157 suffix='_forced_invalid') |
| 158 |
121 # Legacy trybot (SVN-based). | 159 # Legacy trybot (SVN-based). |
122 mastername = 'tryserver.webrtc' | 160 mastername = 'tryserver.webrtc' |
123 buildername = 'linux' | 161 buildername = 'linux' |
124 bot_config = api.webrtc.BUILDERS[mastername]['builders'][buildername] | 162 yield generate_builder(mastername, buildername, revision='12345', |
125 yield generate_builder(mastername, buildername, bot_config, revision='12345', | |
126 legacy_trybot=True, suffix='_legacy_svn_patch') | 163 legacy_trybot=True, suffix='_legacy_svn_patch') |
OLD | NEW |