Bug 1213314: expand try alias support and implement aliases; r=ahal

This adds a lot of functionality to the `flags.aliases` field in the try
comment parser, and implements all of the aliases currently supported by
Buildbot's try_parser.py.

The situation changes slightly because of the way chunks are handled; it's no
longer possible to specify chunks using an alias with no leading `-`.  This
change should not cause undue hardship.
This commit is contained in:
Dustin J. Mitchell
2015-10-22 17:46:39 -04:00
parent 076dbdfb0e
commit 88c74dcfc1
3 changed files with 125 additions and 17 deletions

View File

@@ -49,6 +49,39 @@ class TestCommitParser(unittest.TestCase):
[{ 'test': 'alpha', "only_chunks": set([1, 3]) }]
)
def test_normalize_test_list_with_alias_pattern(self):
self.assertEqual(
normalize_test_list({ "a": '/.*oo.*/' },
['woot', 'foo', 'bar'],
'a, b, c'),
[{ 'test': t } for t in ['woot', 'foo', 'b', 'c']]
)
def test_normalize_test_list_with_alias_pattern_anchored(self):
self.assertEqual(
normalize_test_list({ "a": '/.*oo/' },
['woot', 'foo', 'bar'],
'a, b, c'),
[{ 'test': t } for t in ['foo', 'b', 'c']]
)
def test_normalize_test_list_with_alias_pattern_list(self):
self.assertEqual( sorted(
normalize_test_list({ "a": ['/.*oo/', 'bar', '/bi.*/'] },
['woot', 'foo', 'bar', 'bing', 'baz'],
'a, b')),
sorted([{ 'test': t } for t in ['foo', 'bar', 'bing', 'b']])
)
def test_normalize_test_list_with_alias_pattern_list_chunks(self):
self.assertEqual( sorted(
normalize_test_list({ "a": ['/.*oo/', 'bar', '/bi.*/'] },
['woot', 'foo', 'bar', 'bing', 'baz'],
'a-1, a-4, b')),
sorted([{'test': 'b'}] + [
{ 'test': t, 'only_chunks': set([1, 4])} for t in ['foo', 'bar', 'bing']])
)
def test_invalid_commit(self):
'''
Disallow invalid commit messages from being parsed...