mirror of https://github.com/ARMmbed/mbed-os.git
Test and correct GCC version check
parent
8c17a31c42
commit
c273de6545
|
@ -60,6 +60,37 @@ def test_iar_version_check(_run_cmd):
|
||||||
assert len(notifier.messages) == 2
|
assert len(notifier.messages) == 2
|
||||||
|
|
||||||
|
|
||||||
|
@patch('tools.toolchains.gcc.run_cmd')
|
||||||
|
def test_gcc_version_check(_run_cmd):
|
||||||
|
_run_cmd.return_value = ("""
|
||||||
|
arm-none-eabi-gcc (Arch Repository) 6.4.4
|
||||||
|
Copyright (C) 2018 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
""", "", 0)
|
||||||
|
notifier = MockNotifier()
|
||||||
|
toolchain = TOOLCHAIN_CLASSES["GCC_ARM"](
|
||||||
|
TARGET_MAP["K64F"], notify=notifier)
|
||||||
|
toolchain.version_check()
|
||||||
|
assert notifier.messages == []
|
||||||
|
_run_cmd.return_value = ("""
|
||||||
|
arm-none-eabi-gcc (Arch Repository) 8.1.0
|
||||||
|
Copyright (C) 2018 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
""", "", 0)
|
||||||
|
toolchain.version_check()
|
||||||
|
assert len(notifier.messages) == 1
|
||||||
|
_run_cmd.return_value = ("""
|
||||||
|
arm-none-eabi-gcc (Arch Repository)
|
||||||
|
Copyright (C) 2018 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
""", "", 0)
|
||||||
|
toolchain.version_check()
|
||||||
|
assert len(notifier.messages) == 2
|
||||||
|
|
||||||
|
|
||||||
@given(fixed_dictionaries({
|
@given(fixed_dictionaries({
|
||||||
'common': lists(text()),
|
'common': lists(text()),
|
||||||
'c': lists(text()),
|
'c': lists(text()),
|
||||||
|
|
|
@ -31,7 +31,7 @@ class GCC(mbedToolchain):
|
||||||
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(?P<col>\d+):? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)')
|
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(?P<col>\d+):? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)')
|
||||||
|
|
||||||
GCC_RANGE = (LooseVersion("6.0.0"), LooseVersion("7.0.0"))
|
GCC_RANGE = (LooseVersion("6.0.0"), LooseVersion("7.0.0"))
|
||||||
GCC_VERSION_RE = re.compile("[0-9]*\.[0-9]*\.[0-9]*")
|
GCC_VERSION_RE = re.compile("\d+\.\d+\.\d+")
|
||||||
|
|
||||||
def __init__(self, target, notify=None, macros=None, build_profile=None,
|
def __init__(self, target, notify=None, macros=None, build_profile=None,
|
||||||
build_dir=None):
|
build_dir=None):
|
||||||
|
@ -122,7 +122,7 @@ class GCC(mbedToolchain):
|
||||||
msg = ("Compiler version mismatch: Have {}; "
|
msg = ("Compiler version mismatch: Have {}; "
|
||||||
"expected version >= {} and < {}"
|
"expected version >= {} and < {}"
|
||||||
.format(found_version, min_ver, max_ver))
|
.format(found_version, min_ver, max_ver))
|
||||||
elif not match or len(match.groups()) != 1:
|
elif not match:
|
||||||
msg = ("Compiler version mismatch: Could not detect version; "
|
msg = ("Compiler version mismatch: Could not detect version; "
|
||||||
"expected version >= {} and < {}"
|
"expected version >= {} and < {}"
|
||||||
.format(min_ver, max_ver))
|
.format(min_ver, max_ver))
|
||||||
|
|
Loading…
Reference in New Issue