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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 'bad_nested_config': { | 168 'bad_nested_config': { |
169 'mixins': ['chrome_with_codecs'], | 169 'mixins': ['chrome_with_codecs'], |
170 }, | 170 }, |
171 'rel': { | 171 'rel': { |
172 'gn_args': 'is_debug=false', | 172 'gn_args': 'is_debug=false', |
173 }, | 173 }, |
174 }, | 174 }, |
175 } | 175 } |
176 """ | 176 """ |
177 | 177 |
| 178 |
| 179 GYP_HACKS_CONFIG = """\ |
| 180 { |
| 181 'masters': { |
| 182 'chromium': {}, |
| 183 'fake_master': { |
| 184 'fake_builder': 'fake_config', |
| 185 }, |
| 186 }, |
| 187 'configs': { |
| 188 'fake_config': ['fake_mixin'], |
| 189 }, |
| 190 'mixins': { |
| 191 'fake_mixin': { |
| 192 'type': 'gyp', |
| 193 'gn_args': '', |
| 194 'gyp_defines': |
| 195 ('foo=bar llvm_force_head_revision=1 ' |
| 196 'gyp_link_concurrency=1 baz=1'), |
| 197 }, |
| 198 }, |
| 199 } |
| 200 """ |
| 201 |
| 202 |
178 class UnitTest(unittest.TestCase): | 203 class UnitTest(unittest.TestCase): |
179 def fake_mbw(self, files=None, win32=False): | 204 def fake_mbw(self, files=None, win32=False): |
180 mbw = FakeMBW(win32=win32) | 205 mbw = FakeMBW(win32=win32) |
181 mbw.files.setdefault(mbw.default_config, TEST_CONFIG) | 206 mbw.files.setdefault(mbw.default_config, TEST_CONFIG) |
182 mbw.files.setdefault( | 207 mbw.files.setdefault( |
183 mbw.ToAbsPath('//build/args/bots/fake_master/fake_gn_args_bot.gn'), | 208 mbw.ToAbsPath('//build/args/bots/fake_master/fake_gn_args_bot.gn'), |
184 'is_debug = false\n') | 209 'is_debug = false\n') |
185 if files: | 210 if files: |
186 for path, contents in files.items(): | 211 for path, contents in files.items(): |
187 mbw.files[path] = contents | 212 mbw.files[path] = contents |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 491 |
467 def test_validate(self): | 492 def test_validate(self): |
468 mbw = self.fake_mbw() | 493 mbw = self.fake_mbw() |
469 self.check(['validate'], mbw=mbw, ret=0) | 494 self.check(['validate'], mbw=mbw, ret=0) |
470 | 495 |
471 def test_bad_validate(self): | 496 def test_bad_validate(self): |
472 mbw = self.fake_mbw() | 497 mbw = self.fake_mbw() |
473 mbw.files[mbw.default_config] = TEST_BAD_CONFIG | 498 mbw.files[mbw.default_config] = TEST_BAD_CONFIG |
474 self.check(['validate'], mbw=mbw, ret=1) | 499 self.check(['validate'], mbw=mbw, ret=1) |
475 | 500 |
| 501 def test_gyp_env_hacks(self): |
| 502 mbw = self.fake_mbw() |
| 503 mbw.files[mbw.default_config] = GYP_HACKS_CONFIG |
| 504 self.check(['lookup', '-c', 'fake_config'], mbw=mbw, |
| 505 ret=0, |
| 506 out=("GYP_DEFINES='foo=bar baz=1'\n" |
| 507 "GYP_LINK_CONCURRENCY=1\n" |
| 508 "LLVM_FORCE_HEAD_REVISION=1\n" |
| 509 "python build/gyp_chromium -G output_dir=_path_\n")) |
| 510 |
476 | 511 |
477 if __name__ == '__main__': | 512 if __name__ == '__main__': |
478 unittest.main() | 513 unittest.main() |
OLD | NEW |