diff options
author | Greg Becker <becker33@llnl.gov> | 2023-03-12 00:17:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-12 08:17:09 +0000 |
commit | 66bf9bc7a60666e1946a952da3071053dabd47bc (patch) | |
tree | 80272417baf2438c26f8e2a6e18906b2f43ee5be /lib | |
parent | dee5cb1aeb9990da76d5a16a7a8e85bc276924dd (diff) | |
download | spack-66bf9bc7a60666e1946a952da3071053dabd47bc.tar.gz spack-66bf9bc7a60666e1946a952da3071053dabd47bc.tar.bz2 spack-66bf9bc7a60666e1946a952da3071053dabd47bc.tar.xz spack-66bf9bc7a60666e1946a952da3071053dabd47bc.zip |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/compilers/cce.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/test/compilers/detection.py | 25 |
2 files changed, 26 insertions, 1 deletions
diff --git a/lib/spack/spack/compilers/cce.py b/lib/spack/spack/compilers/cce.py index 2bc00ec7f5..cd9d9f43f1 100644 --- a/lib/spack/spack/compilers/cce.py +++ b/lib/spack/spack/compilers/cce.py @@ -61,7 +61,7 @@ class Cce(Compiler): 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): diff --git a/lib/spack/spack/test/compilers/detection.py b/lib/spack/spack/test/compilers/detection.py index 5bd1fa1d0e..2d3765aef5 100644 --- a/lib/spack/spack/test/compilers/detection.py +++ b/lib/spack/spack/test/compilers/detection.py @@ -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 test_cray_frontend_compiler_detection(compiler, version, tmpdir, monkeypatch 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" |