mirror of https://github.com/ARMmbed/mbed-os.git
Test and correct ARMCC version check
parent
0e56c18058
commit
c174ca3f85
|
@ -18,6 +18,25 @@ from tools.notifier.mock import MockNotifier
|
||||||
|
|
||||||
ALPHABET = [char for char in printable if char not in [u'.', u'/', u'\\']]
|
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({
|
@given(fixed_dictionaries({
|
||||||
'common': lists(text()),
|
'common': lists(text()),
|
||||||
'c': lists(text()),
|
'c': lists(text()),
|
||||||
|
|
|
@ -99,8 +99,8 @@ class ARM(mbedToolchain):
|
||||||
msg = None
|
msg = None
|
||||||
min_ver, max_ver = self.ARMCC_RANGE
|
min_ver, max_ver = self.ARMCC_RANGE
|
||||||
match = self.ARMCC_VERSION_RE.search(stdout)
|
match = self.ARMCC_VERSION_RE.search(stdout)
|
||||||
found_version = LooseVersion(match.group(0)) if match else None
|
found_version = LooseVersion(match.group(1)) if match else None
|
||||||
min_ver, max_ver = self.ARM_RANGE
|
min_ver, max_ver = self.ARMCC_RANGE
|
||||||
if found_version and (found_version < min_ver or found_version >= max_ver):
|
if found_version and (found_version < min_ver or found_version >= max_ver):
|
||||||
msg = ("Compiler version mismatch: Have {}; "
|
msg = ("Compiler version mismatch: Have {}; "
|
||||||
"expected version >= {} and < {}"
|
"expected version >= {} and < {}"
|
||||||
|
|
Loading…
Reference in New Issue