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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 }, | 172 }, |
173 'rel': { | 173 'rel': { |
174 'gn_args': 'is_debug=false', | 174 'gn_args': 'is_debug=false', |
175 }, | 175 }, |
176 }, | 176 }, |
177 'private_configs': ['private'], | 177 'private_configs': ['private'], |
178 'unsupported_configs': ['unsupported'], | 178 'unsupported_configs': ['unsupported'], |
179 } | 179 } |
180 """ | 180 """ |
181 | 181 |
182 | |
183 TEST_BAD_CONFIG_ERR = """\ | |
184 mb config file /fake_src/tools/mb/mb_config.pyl has problems: | |
185 Config "gn_rel_bot_1" used by a bot is also listed in "common_dev_configs". | |
186 Unknown config "unsupported" referenced from "unsupported_configs". | |
187 Unknown config "private" referenced from "private_configs". | |
188 Public artifact builder "a" can not contain the "chrome_with_codecs" mixin. | |
189 Public artifact builder "b" can not contain the "chrome_with_codecs" mixin.""" | |
190 | |
191 | |
192 class UnitTest(unittest.TestCase): | 182 class UnitTest(unittest.TestCase): |
193 def fake_mbw(self, files=None, win32=False): | 183 def fake_mbw(self, files=None, win32=False): |
194 mbw = FakeMBW(win32=win32) | 184 mbw = FakeMBW(win32=win32) |
195 mbw.files.setdefault(mbw.default_config, TEST_CONFIG) | 185 mbw.files.setdefault(mbw.default_config, TEST_CONFIG) |
196 if files: | 186 if files: |
197 for path, contents in files.items(): | 187 for path, contents in files.items(): |
198 mbw.files[path] = contents | 188 mbw.files[path] = contents |
199 return mbw | 189 return mbw |
200 | 190 |
201 def check(self, args, mbw=None, files=None, out=None, err=None, ret=None): | 191 def check(self, args, mbw=None, files=None, out=None, err=None, ret=None): |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 self.check(['validate'], mbw=mbw, ret=0) | 435 self.check(['validate'], mbw=mbw, ret=0) |
446 | 436 |
447 def test_bad_validate(self): | 437 def test_bad_validate(self): |
448 mbw = self.fake_mbw() | 438 mbw = self.fake_mbw() |
449 mbw.files[mbw.default_config] = TEST_BAD_CONFIG | 439 mbw.files[mbw.default_config] = TEST_BAD_CONFIG |
450 self.check(['validate'], mbw=mbw, ret=1) | 440 self.check(['validate'], mbw=mbw, ret=1) |
451 | 441 |
452 | 442 |
453 if __name__ == '__main__': | 443 if __name__ == '__main__': |
454 unittest.main() | 444 unittest.main() |
OLD | NEW |