mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 13:21:28 +00:00
Bug 1146218 - Harden taskcluster platform parser r=wcosta
--HG-- extra : rebase_source : b831d95f5b5e745652d58d8bb8fe1b3917e922e5
This commit is contained in:
parent
e9c6cec993
commit
105ca3f50a
@ -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(''),
|
||||
[]
|
||||
|
Loading…
x
Reference in New Issue
Block a user