Test and correct ARMCC version check

pull/7247/head
Jimmy Brisson 2018-06-26 09:15:01 -05:00
parent 0e56c18058
commit c174ca3f85
2 changed files with 21 additions and 2 deletions

View File

@ -18,6 +18,25 @@ from tools.notifier.mock import MockNotifier
ALPHABET = [char for char in printable if char not in [u'.', u'/', u'\\']]
@patch('tools.toolchains.arm.run_cmd')
def test_arm_version_check(_run_cmd):
_run_cmd.return_value = ("""
Product: ARM Compiler 5.06
Component: ARM Compiler 5.06 update 5 (build 528)
Tool: armcc [4d3621]
""", "", 0)
notifier = MockNotifier()
toolchain = TOOLCHAIN_CLASSES["ARM"](TARGET_MAP["K64F"], notify=notifier)
toolchain.version_check()
assert notifier.messages == []
_run_cmd.return_value = ("""
Product: ARM Compiler
Component: ARM Compiler
Tool: armcc [4d3621]
""", "", 0)
toolchain.version_check()
assert len(notifier.messages) == 1
@given(fixed_dictionaries({
'common': lists(text()),
'c': lists(text()),

View File

@ -99,8 +99,8 @@ class ARM(mbedToolchain):
msg = None
min_ver, max_ver = self.ARMCC_RANGE
match = self.ARMCC_VERSION_RE.search(stdout)
found_version = LooseVersion(match.group(0)) if match else None
min_ver, max_ver = self.ARM_RANGE
found_version = LooseVersion(match.group(1)) if match else None
min_ver, max_ver = self.ARMCC_RANGE
if found_version and (found_version < min_ver or found_version >= max_ver):
msg = ("Compiler version mismatch: Have {}; "
"expected version >= {} and < {}"