OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Tests for mb.py.""" | 6 """Tests for mb.py.""" |
7 | 7 |
8 import json | 8 import json |
9 import StringIO | 9 import StringIO |
10 import os | 10 import os |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 | 96 |
97 def write(self, contents): | 97 def write(self, contents): |
98 self.buf += contents | 98 self.buf += contents |
99 | 99 |
100 def close(self): | 100 def close(self): |
101 self.files[self.name] = self.buf | 101 self.files[self.name] = self.buf |
102 | 102 |
103 | 103 |
104 TEST_CONFIG = """\ | 104 TEST_CONFIG = """\ |
105 { | 105 { |
106 'common_dev_configs': ['gn_debug'], | |
107 'configs': { | 106 'configs': { |
108 'gyp_rel_bot': ['gyp', 'rel', 'goma'], | 107 'gyp_rel_bot': ['gyp', 'rel', 'goma'], |
109 'gn_debug': ['gn', 'debug', 'goma'], | 108 'gn_debug_goma': ['gn', 'debug', 'goma'], |
110 'gyp_debug': ['gyp', 'debug'], | 109 'gyp_debug': ['gyp', 'debug', 'fake_feature1'], |
111 'gn_rel_bot': ['gn', 'rel', 'goma'], | 110 'gn_rel_bot': ['gn', 'rel', 'goma'], |
112 'private': ['gyp', 'rel', 'fake_feature1'], | 111 'gyp_crosscompile': ['gyp', 'crosscompile'], |
113 'unsupported': ['gn', 'fake_feature2'], | |
114 }, | 112 }, |
115 'masters': { | 113 'masters': { |
116 'chromium': {}, | 114 'chromium': {}, |
117 'fake_master': { | 115 'fake_master': { |
118 'fake_builder': 'gyp_rel_bot', | 116 'fake_builder': 'gyp_rel_bot', |
119 'fake_gn_builder': 'gn_rel_bot', | 117 'fake_gn_builder': 'gn_rel_bot', |
118 'fake_gyp_crosscompile_builder': 'gyp_crosscompile', | |
119 'fake_gn_debug_builder': 'gn_debug_goma', | |
120 'fake_gyp_builder': 'gyp_debug', | 120 'fake_gyp_builder': 'gyp_debug', |
121 }, | 121 }, |
122 }, | 122 }, |
123 'mixins': { | 123 'mixins': { |
124 'crosscompile': { | |
125 'gyp_crosscompile': True, | |
126 }, | |
124 'fake_feature1': { | 127 'fake_feature1': { |
125 'gn_args': 'enable_doom_melon=true', | 128 'gn_args': 'enable_doom_melon=true', |
126 'gyp_crosscompile': True, | |
127 'gyp_defines': 'doom_melon=1', | 129 'gyp_defines': 'doom_melon=1', |
128 }, | 130 }, |
129 'fake_feature2': { | |
130 'gn_args': 'enable_doom_melon=false', | |
131 'gyp_defaults': 'doom_melon=0', | |
132 }, | |
133 'gyp': {'type': 'gyp'}, | 131 'gyp': {'type': 'gyp'}, |
134 'gn': {'type': 'gn'}, | 132 'gn': {'type': 'gn'}, |
135 'goma': { | 133 'goma': { |
136 'gn_args': 'use_goma=true goma_dir="$(goma_dir)"', | 134 'gn_args': 'use_goma=true goma_dir="$(goma_dir)"', |
137 'gyp_defines': 'goma=1 gomadir=$(goma_dir)', | 135 'gyp_defines': 'goma=1 gomadir=$(goma_dir)', |
138 }, | 136 }, |
139 'rel': { | 137 'rel': { |
140 'gn_args': 'is_debug=false', | 138 'gn_args': 'is_debug=false', |
141 }, | 139 }, |
142 'debug': { | 140 'debug': { |
143 'gn_args': 'is_debug=true', | 141 'gn_args': 'is_debug=true', |
144 }, | 142 }, |
145 }, | 143 }, |
146 'private_configs': ['private'], | |
147 'unsupported_configs': ['unsupported'], | |
148 } | 144 } |
149 """ | 145 """ |
150 | 146 |
151 | 147 |
152 TEST_BAD_CONFIG = """\ | 148 TEST_BAD_CONFIG = """\ |
153 { | 149 { |
154 'common_dev_configs': ['gn_rel_bot_1'], | |
155 'configs': { | 150 'configs': { |
156 'gn_rel_bot_1': ['gn', 'rel', 'chrome_with_codecs'], | 151 'gn_rel_bot_1': ['gn', 'rel', 'chrome_with_codecs'], |
157 'gn_rel_bot_2': ['gn', 'rel', 'bad_nested_config'], | 152 'gn_rel_bot_2': ['gn', 'rel', 'bad_nested_config'], |
158 }, | 153 }, |
159 'masters': { | 154 'masters': { |
160 'chromium': { | 155 'chromium': { |
161 'a': 'gn_rel_bot_1', | 156 'a': 'gn_rel_bot_1', |
162 'b': 'gn_rel_bot_2', | 157 'b': 'gn_rel_bot_2', |
163 }, | 158 }, |
164 }, | 159 }, |
165 'mixins': { | 160 'mixins': { |
166 'gn': {'type': 'gn'}, | 161 'gn': {'type': 'gn'}, |
167 'chrome_with_codecs': { | 162 'chrome_with_codecs': { |
168 'gn_args': 'proprietary_codecs=true', | 163 'gn_args': 'proprietary_codecs=true', |
169 }, | 164 }, |
170 'bad_nested_config': { | 165 'bad_nested_config': { |
171 'mixins': ['chrome_with_codecs'], | 166 'mixins': ['chrome_with_codecs'], |
172 }, | 167 }, |
173 'rel': { | 168 'rel': { |
174 'gn_args': 'is_debug=false', | 169 'gn_args': 'is_debug=false', |
175 }, | 170 }, |
176 }, | 171 }, |
177 'private_configs': ['private'], | |
178 'unsupported_configs': ['unsupported'], | |
179 } | 172 } |
180 """ | 173 """ |
181 | 174 |
182 class UnitTest(unittest.TestCase): | 175 class UnitTest(unittest.TestCase): |
183 def fake_mbw(self, files=None, win32=False): | 176 def fake_mbw(self, files=None, win32=False): |
184 mbw = FakeMBW(win32=win32) | 177 mbw = FakeMBW(win32=win32) |
185 mbw.files.setdefault(mbw.default_config, TEST_CONFIG) | 178 mbw.files.setdefault(mbw.default_config, TEST_CONFIG) |
186 if files: | 179 if files: |
187 for path, contents in files.items(): | 180 for path, contents in files.items(): |
188 mbw.files[path] = contents | 181 mbw.files[path] = contents |
(...skipping 13 matching lines...) Expand all Loading... | |
202 return mbw | 195 return mbw |
203 | 196 |
204 def test_clobber(self): | 197 def test_clobber(self): |
205 files = { | 198 files = { |
206 '/fake_src/out/Debug': None, | 199 '/fake_src/out/Debug': None, |
207 '/fake_src/out/Debug/mb_type': None, | 200 '/fake_src/out/Debug/mb_type': None, |
208 } | 201 } |
209 mbw = self.fake_mbw(files) | 202 mbw = self.fake_mbw(files) |
210 | 203 |
211 # The first time we run this, the build dir doesn't exist, so no clobber. | 204 # The first time we run this, the build dir doesn't exist, so no clobber. |
212 self.check(['gen', '-c', 'gn_debug', '//out/Debug'], mbw=mbw, ret=0) | 205 self.check(['gen', '-c', 'gn_debug_goma', '//out/Debug'], mbw=mbw, ret=0) |
213 self.assertEqual(mbw.rmdirs, []) | 206 self.assertEqual(mbw.rmdirs, []) |
214 self.assertEqual(mbw.files['/fake_src/out/Debug/mb_type'], 'gn') | 207 self.assertEqual(mbw.files['/fake_src/out/Debug/mb_type'], 'gn') |
215 | 208 |
216 # The second time we run this, the build dir exists and matches, so no | 209 # The second time we run this, the build dir exists and matches, so no |
217 # clobber. | 210 # clobber. |
218 self.check(['gen', '-c', 'gn_debug', '//out/Debug'], mbw=mbw, ret=0) | 211 self.check(['gen', '-c', 'gn_debug_goma', '//out/Debug'], mbw=mbw, ret=0) |
219 self.assertEqual(mbw.rmdirs, []) | 212 self.assertEqual(mbw.rmdirs, []) |
220 self.assertEqual(mbw.files['/fake_src/out/Debug/mb_type'], 'gn') | 213 self.assertEqual(mbw.files['/fake_src/out/Debug/mb_type'], 'gn') |
221 | 214 |
222 # Now we switch build types; this should result in a clobber. | 215 # Now we switch build types; this should result in a clobber. |
223 self.check(['gen', '-c', 'gyp_debug', '//out/Debug'], mbw=mbw, ret=0) | 216 self.check(['gen', '-c', 'gyp_debug', '//out/Debug'], mbw=mbw, ret=0) |
224 self.assertEqual(mbw.rmdirs, ['/fake_src/out/Debug']) | 217 self.assertEqual(mbw.rmdirs, ['/fake_src/out/Debug']) |
225 self.assertEqual(mbw.files['/fake_src/out/Debug/mb_type'], 'gyp') | 218 self.assertEqual(mbw.files['/fake_src/out/Debug/mb_type'], 'gyp') |
226 | 219 |
227 # Now we delete mb_type; this checks the case where the build dir | 220 # Now we delete mb_type; this checks the case where the build dir |
228 # exists but wasn't populated by mb; this should also result in a clobber. | 221 # exists but wasn't populated by mb; this should also result in a clobber. |
229 del mbw.files['/fake_src/out/Debug/mb_type'] | 222 del mbw.files['/fake_src/out/Debug/mb_type'] |
230 self.check(['gen', '-c', 'gyp_debug', '//out/Debug'], mbw=mbw, ret=0) | 223 self.check(['gen', '-c', 'gyp_debug', '//out/Debug'], mbw=mbw, ret=0) |
231 self.assertEqual(mbw.rmdirs, | 224 self.assertEqual(mbw.rmdirs, |
232 ['/fake_src/out/Debug', '/fake_src/out/Debug']) | 225 ['/fake_src/out/Debug', '/fake_src/out/Debug']) |
233 self.assertEqual(mbw.files['/fake_src/out/Debug/mb_type'], 'gyp') | 226 self.assertEqual(mbw.files['/fake_src/out/Debug/mb_type'], 'gyp') |
234 | 227 |
235 def test_gn_analyze(self): | 228 def test_gn_analyze(self): |
236 files = {'/tmp/in.json': """{\ | 229 files = {'/tmp/in.json': """{\ |
237 "files": ["foo/foo_unittest.cc"], | 230 "files": ["foo/foo_unittest.cc"], |
238 "test_targets": ["foo_unittests", "bar_unittests"], | 231 "test_targets": ["foo_unittests", "bar_unittests"], |
239 "additional_compile_targets": [] | 232 "additional_compile_targets": [] |
240 }"""} | 233 }"""} |
241 | 234 |
242 mbw = self.fake_mbw(files) | 235 mbw = self.fake_mbw(files) |
243 mbw.Call = lambda cmd, env=None, buffer_output=True: ( | 236 mbw.Call = lambda cmd, env=None, buffer_output=True: ( |
244 0, 'out/Default/foo_unittests\n', '') | 237 0, 'out/Default/foo_unittests\n', '') |
245 | 238 |
246 self.check(['analyze', '-c', 'gn_debug', '//out/Default', | 239 self.check(['analyze', '-c', 'gn_debug_goma', '//out/Default', |
247 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0) | 240 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0) |
248 out = json.loads(mbw.files['/tmp/out.json']) | 241 out = json.loads(mbw.files['/tmp/out.json']) |
249 self.assertEqual(out, { | 242 self.assertEqual(out, { |
250 'status': 'Found dependency', | 243 'status': 'Found dependency', |
251 'compile_targets': ['foo_unittests'], | 244 'compile_targets': ['foo_unittests'], |
252 'test_targets': ['foo_unittests'] | 245 'test_targets': ['foo_unittests'] |
253 }) | 246 }) |
254 | 247 |
255 def test_gn_analyze_all(self): | 248 def test_gn_analyze_all(self): |
256 files = {'/tmp/in.json': """{\ | 249 files = {'/tmp/in.json': """{\ |
257 "files": ["foo/foo_unittest.cc"], | 250 "files": ["foo/foo_unittest.cc"], |
258 "test_targets": ["bar_unittests"], | 251 "test_targets": ["bar_unittests"], |
259 "additional_compile_targets": ["all"] | 252 "additional_compile_targets": ["all"] |
260 }"""} | 253 }"""} |
261 mbw = self.fake_mbw(files) | 254 mbw = self.fake_mbw(files) |
262 mbw.Call = lambda cmd, env=None, buffer_output=True: ( | 255 mbw.Call = lambda cmd, env=None, buffer_output=True: ( |
263 0, 'out/Default/foo_unittests\n', '') | 256 0, 'out/Default/foo_unittests\n', '') |
264 self.check(['analyze', '-c', 'gn_debug', '//out/Default', | 257 self.check(['analyze', '-c', 'gn_debug_goma', '//out/Default', |
265 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0) | 258 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0) |
266 out = json.loads(mbw.files['/tmp/out.json']) | 259 out = json.loads(mbw.files['/tmp/out.json']) |
267 self.assertEqual(out, { | 260 self.assertEqual(out, { |
268 'status': 'Found dependency (all)', | 261 'status': 'Found dependency (all)', |
269 'compile_targets': ['all', 'bar_unittests'], | 262 'compile_targets': ['all', 'bar_unittests'], |
270 'test_targets': ['bar_unittests'], | 263 'test_targets': ['bar_unittests'], |
271 }) | 264 }) |
272 | 265 |
273 def test_gn_analyze_missing_file(self): | 266 def test_gn_analyze_missing_file(self): |
274 files = {'/tmp/in.json': """{\ | 267 files = {'/tmp/in.json': """{\ |
275 "files": ["foo/foo_unittest.cc"], | 268 "files": ["foo/foo_unittest.cc"], |
276 "test_targets": ["bar_unittests"], | 269 "test_targets": ["bar_unittests"], |
277 "additional_compile_targets": [] | 270 "additional_compile_targets": [] |
278 }"""} | 271 }"""} |
279 mbw = self.fake_mbw(files) | 272 mbw = self.fake_mbw(files) |
280 mbw.cmds = [ | 273 mbw.cmds = [ |
281 (0, '', ''), | 274 (0, '', ''), |
282 (1, 'The input matches no targets, configs, or files\n', ''), | 275 (1, 'The input matches no targets, configs, or files\n', ''), |
283 (1, 'The input matches no targets, configs, or files\n', ''), | 276 (1, 'The input matches no targets, configs, or files\n', ''), |
284 ] | 277 ] |
285 | 278 |
286 self.check(['analyze', '-c', 'gn_debug', '//out/Default', | 279 self.check(['analyze', '-c', 'gn_debug_goma', '//out/Default', |
287 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0) | 280 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0) |
288 out = json.loads(mbw.files['/tmp/out.json']) | 281 out = json.loads(mbw.files['/tmp/out.json']) |
289 self.assertEqual(out, { | 282 self.assertEqual(out, { |
290 'status': 'No dependency', | 283 'status': 'No dependency', |
291 'compile_targets': [], | 284 'compile_targets': [], |
292 'test_targets': [], | 285 'test_targets': [], |
293 }) | 286 }) |
294 | 287 |
295 def test_gn_gen(self): | 288 def test_gn_gen(self): |
296 self.check(['gen', '-c', 'gn_debug', '//out/Default', '-g', '/goma'], | 289 self.check(['gen', '-c', 'gn_debug_goma', '//out/Default', '-g', '/goma'], |
297 ret=0, | 290 ret=0, |
298 out=('/fake_src/buildtools/linux64/gn gen //out/Default ' | 291 out=('/fake_src/buildtools/linux64/gn gen //out/Default ' |
299 '\'--args=is_debug=true use_goma=true goma_dir="/goma"\' ' | 292 '\'--args=is_debug=true use_goma=true goma_dir="/goma"\' ' |
300 '--check\n')) | 293 '--check\n')) |
301 | 294 |
302 mbw = self.fake_mbw(win32=True) | 295 mbw = self.fake_mbw(win32=True) |
303 self.check(['gen', '-c', 'gn_debug', '-g', 'c:\\goma', '//out/Debug'], | 296 self.check(['gen', '-c', 'gn_debug_goma', '-g', 'c:\\goma', '//out/Debug'], |
304 mbw=mbw, ret=0, | 297 mbw=mbw, ret=0, |
305 out=('c:\\fake_src\\buildtools\\win\\gn.exe gen //out/Debug ' | 298 out=('c:\\fake_src\\buildtools\\win\\gn.exe gen //out/Debug ' |
306 '"--args=is_debug=true use_goma=true goma_dir=\\"' | 299 '"--args=is_debug=true use_goma=true goma_dir=\\"' |
307 'c:\\goma\\"" --check\n')) | 300 'c:\\goma\\"" --check\n')) |
308 | 301 |
309 | 302 |
310 def test_gn_gen_fails(self): | 303 def test_gn_gen_fails(self): |
311 mbw = self.fake_mbw() | 304 mbw = self.fake_mbw() |
312 mbw.Call = lambda cmd, env=None, buffer_output=True: (1, '', '') | 305 mbw.Call = lambda cmd, env=None, buffer_output=True: (1, '', '') |
313 self.check(['gen', '-c', 'gn_debug', '//out/Default'], mbw=mbw, ret=1) | 306 self.check(['gen', '-c', 'gn_debug_goma', '//out/Default'], mbw=mbw, ret=1) |
314 | 307 |
315 def test_gn_gen_swarming(self): | 308 def test_gn_gen_swarming(self): |
316 files = { | 309 files = { |
317 '/tmp/swarming_targets': 'base_unittests\n', | 310 '/tmp/swarming_targets': 'base_unittests\n', |
318 '/fake_src/testing/buildbot/gn_isolate_map.pyl': ( | 311 '/fake_src/testing/buildbot/gn_isolate_map.pyl': ( |
319 "{'base_unittests': {" | 312 "{'base_unittests': {" |
320 " 'label': '//base:base_unittests'," | 313 " 'label': '//base:base_unittests'," |
321 " 'type': 'raw'," | 314 " 'type': 'raw'," |
322 " 'args': []," | 315 " 'args': []," |
323 "}}\n" | 316 "}}\n" |
324 ), | 317 ), |
325 '/fake_src/out/Default/base_unittests.runtime_deps': ( | 318 '/fake_src/out/Default/base_unittests.runtime_deps': ( |
326 "base_unittests\n" | 319 "base_unittests\n" |
327 ), | 320 ), |
328 } | 321 } |
329 mbw = self.fake_mbw(files) | 322 mbw = self.fake_mbw(files) |
330 self.check(['gen', | 323 self.check(['gen', |
331 '-c', 'gn_debug', | 324 '-c', 'gn_debug_goma', |
332 '--swarming-targets-file', '/tmp/swarming_targets', | 325 '--swarming-targets-file', '/tmp/swarming_targets', |
333 '//out/Default'], mbw=mbw, ret=0) | 326 '//out/Default'], mbw=mbw, ret=0) |
334 self.assertIn('/fake_src/out/Default/base_unittests.isolate', | 327 self.assertIn('/fake_src/out/Default/base_unittests.isolate', |
335 mbw.files) | 328 mbw.files) |
336 self.assertIn('/fake_src/out/Default/base_unittests.isolated.gen.json', | 329 self.assertIn('/fake_src/out/Default/base_unittests.isolated.gen.json', |
337 mbw.files) | 330 mbw.files) |
338 | 331 |
339 def test_gn_isolate(self): | 332 def test_gn_isolate(self): |
340 files = { | 333 files = { |
341 '/fake_src/testing/buildbot/gn_isolate_map.pyl': ( | 334 '/fake_src/testing/buildbot/gn_isolate_map.pyl': ( |
342 "{'base_unittests': {" | 335 "{'base_unittests': {" |
343 " 'label': '//base:base_unittests'," | 336 " 'label': '//base:base_unittests'," |
344 " 'type': 'raw'," | 337 " 'type': 'raw'," |
345 " 'args': []," | 338 " 'args': []," |
346 "}}\n" | 339 "}}\n" |
347 ), | 340 ), |
348 '/fake_src/out/Default/base_unittests.runtime_deps': ( | 341 '/fake_src/out/Default/base_unittests.runtime_deps': ( |
349 "base_unittests\n" | 342 "base_unittests\n" |
350 ), | 343 ), |
351 } | 344 } |
352 self.check(['isolate', '-c', 'gn_debug', '//out/Default', 'base_unittests'], | 345 self.check(['isolate', '-c', 'gn_debug_goma', '//out/Default', |
353 files=files, ret=0) | 346 'base_unittests'], files=files, ret=0) |
354 | 347 |
355 # test running isolate on an existing build_dir | 348 # test running isolate on an existing build_dir |
356 files['/fake_src/out/Default/args.gn'] = 'is_debug = True\n' | 349 files['/fake_src/out/Default/args.gn'] = 'is_debug = True\n' |
357 self.check(['isolate', '//out/Default', 'base_unittests'], | 350 self.check(['isolate', '//out/Default', 'base_unittests'], |
358 files=files, ret=0) | 351 files=files, ret=0) |
359 | 352 |
360 files['/fake_src/out/Default/mb_type'] = 'gn\n' | 353 files['/fake_src/out/Default/mb_type'] = 'gn\n' |
361 self.check(['isolate', '//out/Default', 'base_unittests'], | 354 self.check(['isolate', '//out/Default', 'base_unittests'], |
362 files=files, ret=0) | 355 files=files, ret=0) |
363 | 356 |
364 def test_gn_run(self): | 357 def test_gn_run(self): |
365 files = { | 358 files = { |
366 '/fake_src/testing/buildbot/gn_isolate_map.pyl': ( | 359 '/fake_src/testing/buildbot/gn_isolate_map.pyl': ( |
367 "{'base_unittests': {" | 360 "{'base_unittests': {" |
368 " 'label': '//base:base_unittests'," | 361 " 'label': '//base:base_unittests'," |
369 " 'type': 'raw'," | 362 " 'type': 'raw'," |
370 " 'args': []," | 363 " 'args': []," |
371 "}}\n" | 364 "}}\n" |
372 ), | 365 ), |
373 '/fake_src/out/Default/base_unittests.runtime_deps': ( | 366 '/fake_src/out/Default/base_unittests.runtime_deps': ( |
374 "base_unittests\n" | 367 "base_unittests\n" |
375 ), | 368 ), |
376 } | 369 } |
377 self.check(['run', '-c', 'gn_debug', '//out/Default', 'base_unittests'], | 370 self.check(['run', '-c', 'gn_debug_goma', '//out/Default', |
378 files=files, ret=0) | 371 'base_unittests'], files=files, ret=0) |
379 | 372 |
380 def test_gn_lookup(self): | 373 def test_gn_lookup(self): |
381 self.check(['lookup', '-c', 'gn_debug'], ret=0) | 374 self.check(['lookup', '-c', 'gn_debug_goma'], ret=0) |
382 | 375 |
383 def test_gn_lookup_goma_dir_expansion(self): | 376 def test_gn_lookup_goma_dir_expansion(self): |
384 self.check(['lookup', '-c', 'gn_rel_bot', '-g', '/foo'], ret=0, | 377 self.check(['lookup', '-c', 'gn_rel_bot', '-g', '/foo'], ret=0, |
385 out=("/fake_src/buildtools/linux64/gn gen _path_ " | 378 out=("/fake_src/buildtools/linux64/gn gen _path_ " |
386 "'--args=is_debug=false use_goma=true " | 379 "'--args=is_debug=false use_goma=true " |
387 "goma_dir=\"/foo\"'\n" )) | 380 "goma_dir=\"/foo\"'\n" )) |
388 | 381 |
389 def test_gyp_analyze(self): | 382 def test_gyp_analyze(self): |
390 mbw = self.check(['analyze', '-c', 'gyp_rel_bot', '//out/Release', | 383 mbw = self.check(['analyze', '-c', 'gyp_rel_bot', '//out/Release', |
391 '/tmp/in.json', '/tmp/out.json'], | 384 '/tmp/in.json', '/tmp/out.json'], ret=0) |
kjellander_chromium
2016/03/17 05:04:31
nit: +1 space indent.
| |
392 ret=0) | |
393 self.assertIn('analyzer', mbw.calls[0]) | 385 self.assertIn('analyzer', mbw.calls[0]) |
394 | 386 |
395 def test_gyp_crosscompile(self): | 387 def test_gyp_crosscompile(self): |
396 mbw = self.fake_mbw() | 388 mbw = self.fake_mbw() |
397 self.check(['gen', '-c', 'private', '//out/Release'], mbw=mbw, ret=0) | 389 self.check(['gen', '-c', 'gyp_crosscompile', '//out/Release'], |
390 mbw=mbw, ret=0) | |
398 self.assertTrue(mbw.cross_compile) | 391 self.assertTrue(mbw.cross_compile) |
399 | 392 |
400 def test_gyp_gen(self): | 393 def test_gyp_gen(self): |
401 self.check(['gen', '-c', 'gyp_rel_bot', '-g', '/goma', '//out/Release'], | 394 self.check(['gen', '-c', 'gyp_rel_bot', '-g', '/goma', '//out/Release'], |
402 ret=0, | 395 ret=0, |
403 out=("GYP_DEFINES='goma=1 gomadir=/goma'\n" | 396 out=("GYP_DEFINES='goma=1 gomadir=/goma'\n" |
404 "python build/gyp_chromium -G output_dir=out\n")) | 397 "python build/gyp_chromium -G output_dir=out\n")) |
405 | 398 |
406 mbw = self.fake_mbw(win32=True) | 399 mbw = self.fake_mbw(win32=True) |
407 self.check(['gen', '-c', 'gyp_rel_bot', '-g', 'c:\\goma', '//out/Release'], | 400 self.check(['gen', '-c', 'gyp_rel_bot', '-g', 'c:\\goma', '//out/Release'], |
(...skipping 27 matching lines...) Expand all Loading... | |
435 self.check(['validate'], mbw=mbw, ret=0) | 428 self.check(['validate'], mbw=mbw, ret=0) |
436 | 429 |
437 def test_bad_validate(self): | 430 def test_bad_validate(self): |
438 mbw = self.fake_mbw() | 431 mbw = self.fake_mbw() |
439 mbw.files[mbw.default_config] = TEST_BAD_CONFIG | 432 mbw.files[mbw.default_config] = TEST_BAD_CONFIG |
440 self.check(['validate'], mbw=mbw, ret=1) | 433 self.check(['validate'], mbw=mbw, ret=1) |
441 | 434 |
442 | 435 |
443 if __name__ == '__main__': | 436 if __name__ == '__main__': |
444 unittest.main() | 437 unittest.main() |
OLD | NEW |