summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/compilers/aocc.py7
-rw-r--r--lib/spack/spack/test/compilers/detection.py5
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/spack/spack/compilers/aocc.py b/lib/spack/spack/compilers/aocc.py
index dcb6589861..b544a42e79 100644
--- a/lib/spack/spack/compilers/aocc.py
+++ b/lib/spack/spack/compilers/aocc.py
@@ -98,15 +98,12 @@ class Aocc(Compiler):
@classmethod
@llnl.util.lang.memoized
def extract_version_from_output(cls, output):
- loc_ver = 'unknown'
-
match = re.search(
- r'AMD clang version ([^ )]+)',
+ r'AOCC_(\d+)[._](\d+)[._](\d+)',
output
)
if match:
- loc_ver = output.split('AOCC_')[1].split('-')[0]
- return loc_ver
+ return '.'.join(match.groups())
@classmethod
def fc_version(cls, fortran_compiler):
diff --git a/lib/spack/spack/test/compilers/detection.py b/lib/spack/spack/test/compilers/detection.py
index 58d03fbfe4..06095c4bf4 100644
--- a/lib/spack/spack/test/compilers/detection.py
+++ b/lib/spack/spack/test/compilers/detection.py
@@ -345,6 +345,11 @@ def test_cray_frontend_compiler_detection(
@pytest.mark.parametrize('version_str,expected_version', [
# This applies to C,C++ and FORTRAN compiler
+ ('AMD clang version 12.0.0 (CLANG: AOCC_3_1_0-Build#126 2021_06_07)'
+ '(based on LLVM Mirror.Version.12.0.0)\n'
+ 'Target: x86_64-unknown-linux-gnu\n'
+ 'Thread model: posix\n', '3.1.0'
+ ),
('AMD clang version 12.0.0 (CLANG: AOCC_3.0.0-Build#78 2020_12_10)'
'(based on LLVM Mirror.Version.12.0.0)\n'
'Target: x86_64-unknown-linux-gnu\n'