cce compiler: bugfix for version regex to avoid conflation with apple-clang (#35974)

Currently apple-clang is detected as cce, and it should not be.
---------

Co-authored-by: becker33 <becker33@users.noreply.github.com>
This commit is contained in:
Greg Becker 2023-03-12 00:17:09 -08:00 committed by GitHub
parent dee5cb1aeb
commit 66bf9bc7a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View file

@ -61,7 +61,7 @@ def is_clang_based(self):
return version >= ver("9.0") and "classic" not in str(version)
version_argument = "--version"
version_regex = r"[Vv]ersion.*?(\d+(\.\d+)+)"
version_regex = r"[Cc]ray (?:clang|C :|C\+\+ :|Fortran :) [Vv]ersion.*?(\d+(\.\d+)+)"
@property
def verbose_flag(self):

View file

@ -58,6 +58,7 @@ def test_arm_version_detection(version_str, expected_version):
[
("Cray C : Version 8.4.6 Mon Apr 15, 2019 12:13:39\n", "8.4.6"),
("Cray C++ : Version 8.4.6 Mon Apr 15, 2019 12:13:45\n", "8.4.6"),
("Cray clang Version 8.4.6 Mon Apr 15, 2019 12:13:45\n", "8.4.6"),
("Cray Fortran : Version 8.4.6 Mon Apr 15, 2019 12:13:55\n", "8.4.6"),
],
)
@ -487,3 +488,27 @@ def _module(cmd, *args):
def test_aocc_version_detection(version_str, expected_version):
version = spack.compilers.aocc.Aocc.extract_version_from_output(version_str)
assert version == expected_version
@pytest.mark.regression("33901")
@pytest.mark.parametrize(
"version_str",
[
(
"Apple clang version 11.0.0 (clang-1100.0.33.8)\n"
"Target: x86_64-apple-darwin18.7.0\n"
"Thread model: posix\n"
"InstalledDir: "
"/Applications/Xcode.app/Contents/Developer/Toolchains/"
"XcodeDefault.xctoolchain/usr/bin\n"
),
(
"Apple LLVM version 7.0.2 (clang-700.1.81)\n"
"Target: x86_64-apple-darwin15.2.0\n"
"Thread model: posix\n"
),
],
)
def test_apple_clang_not_detected_as_cce(version_str):
version = spack.compilers.cce.Cce.extract_version_from_output(version_str)
assert version == "unknown"