Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Unified Diff: tools/mb/mb_unittest.py

Issue 1773883002: Enable all Android builders to use 'chrome_with_codecs'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wmpi_test
Patch Set: Fix exception check. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« tools/mb/mb.py ('K') | « tools/mb/mb_config.pyl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/mb/mb_unittest.py
diff --git a/tools/mb/mb_unittest.py b/tools/mb/mb_unittest.py
index b836ab048fbc5b97ee3c8d45b967e4e17c2389e9..6a0218c664194673e522059b2b010891a8807176 100755
--- a/tools/mb/mb_unittest.py
+++ b/tools/mb/mb_unittest.py
@@ -113,6 +113,7 @@ TEST_CONFIG = """\
'unsupported': ['gn', 'fake_feature2'],
},
'masters': {
+ 'chromium': {},
'fake_master': {
'fake_builder': 'gyp_rel_bot',
'fake_gn_builder': 'gn_rel_bot',
@@ -148,6 +149,46 @@ TEST_CONFIG = """\
"""
+TEST_BAD_CONFIG = """\
+{
+ 'common_dev_configs': ['gn_rel_bot_1'],
+ 'configs': {
+ 'gn_rel_bot_1': ['gn', 'rel', 'chrome_with_codecs'],
+ 'gn_rel_bot_2': ['gn', 'rel', 'bad_nested_config'],
+ },
+ 'masters': {
+ 'chromium': {
+ 'a': 'gn_rel_bot_1',
+ 'b': 'gn_rel_bot_2',
+ },
+ },
+ 'mixins': {
+ 'gn': {'type': 'gn'},
+ 'chrome_with_codecs': {
+ 'gn_args': 'proprietary_codecs=true',
+ },
+ 'bad_nested_config': {
+ 'mixins': ['chrome_with_codecs'],
+ },
+ 'rel': {
+ 'gn_args': 'is_debug=false',
+ },
+ },
+ 'private_configs': ['private'],
+ 'unsupported_configs': ['unsupported'],
+}
+"""
+
+
+TEST_BAD_CONFIG_ERR = """\
+mb config file /fake_src/tools/mb/mb_config.pyl has problems:
+ Config "gn_rel_bot_1" used by a bot is also listed in "common_dev_configs".
+ Unknown config "unsupported" referenced from "unsupported_configs".
+ Unknown config "private" referenced from "private_configs".
+ Public artifact builder "a" can not contain the "chrome_with_codecs" mixin.
+ Public artifact builder "b" can not contain the "chrome_with_codecs" mixin."""
+
+
class UnitTest(unittest.TestCase):
def fake_mbw(self, files=None, win32=False):
mbw = FakeMBW(win32=win32)
@@ -157,13 +198,19 @@ class UnitTest(unittest.TestCase):
mbw.files[path] = contents
return mbw
- def check(self, args, mbw=None, files=None, out=None, err=None, ret=None):
+ def check(self, args, mbw=None, files=None, out=None, err=None, ret=None,
+ exception=None):
if not mbw:
mbw = self.fake_mbw(files)
mbw.ParseArgs(args)
- actual_ret = mbw.args.func()
- if ret is not None:
- self.assertEqual(actual_ret, ret)
+
+ actual_ret = None
+ if exception is not None:
+ self.assertRaisesRegexp(Exception, exception, mbw.args.func)
+ else:
+ actual_ret = mbw.args.func()
+
+ self.assertEqual(actual_ret, ret)
if out is not None:
self.assertEqual(mbw.out, out)
if err is not None:
@@ -363,7 +410,7 @@ class UnitTest(unittest.TestCase):
def test_gyp_crosscompile(self):
mbw = self.fake_mbw()
- self.check(['gen', '-c', 'private', '//out/Release'], mbw=mbw)
+ self.check(['gen', '-c', 'private', '//out/Release'], mbw=mbw, ret=0)
self.assertTrue(mbw.cross_compile)
def test_gyp_gen(self):
@@ -398,10 +445,14 @@ class UnitTest(unittest.TestCase):
finally:
sys.stdout = orig_stdout
-
def test_validate(self):
self.check(['validate'], ret=0)
+ def test_bad_validate(self):
+ mbw = self.fake_mbw()
+ mbw.files[mbw.default_config] = TEST_BAD_CONFIG
+ self.check(['validate'], mbw=mbw, exception=TEST_BAD_CONFIG_ERR)
+
if __name__ == '__main__':
unittest.main()
« tools/mb/mb.py ('K') | « tools/mb/mb_config.pyl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698