Bug 1146218 - Harden taskcluster platform parser r=wcosta

--HG--
extra : rebase_source : b831d95f5b5e745652d58d8bb8fe1b3917e922e5
This commit is contained in:
jlal@mozilla.com 2015-03-22 20:02:20 -07:00
Родитель e9c6cec993
Коммит 105ca3f50a
2 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -17,6 +17,8 @@ def parse_test_opts(input_str):
tests.insert(0, cur_test)
def add_platform(value):
# Ensure platforms exists...
cur_test['platforms'] = cur_test.get('platforms', [])
cur_test['platforms'].insert(0, value.strip())
# This might be somewhat confusing but we parse the string _backwards_ so
@ -45,7 +47,6 @@ def parse_test_opts(input_str):
elif char == ']':
# Entering platform state.
in_platforms = True
cur_test['platforms'] = []
else:
# Accumulator.
token = char + token

Просмотреть файл

@ -29,6 +29,18 @@ class TryTestParserTest(unittest.TestCase):
]
)
self.assertEquals(
parse_test_opts('mochitest-3[Ubuntu,10.6,10.8,Windows XP,Windows 7,Windows 8]'),
[
{
'test': 'mochitest-3',
'platforms': [
'Ubuntu', '10.6', '10.8', 'Windows XP', 'Windows 7', 'Windows 8'
]
}
]
)
self.assertEquals(
parse_test_opts(''),
[]