summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLPettey-Arm <58987326+LPettey-Arm@users.noreply.github.com>2020-04-07 10:58:54 -0500
committerGitHub <noreply@github.com>2020-04-07 10:58:54 -0500
commitda9ba2b2549e39b6707c7095a2e97db7e3d3efeb (patch)
tree7e9ba69c8a375e5f593a927696363ce57edefac2
parentf83d46bb7934444152a0445624d21caef3d2c9a4 (diff)
downloadspack-da9ba2b2549e39b6707c7095a2e97db7e3d3efeb.tar.gz
spack-da9ba2b2549e39b6707c7095a2e97db7e3d3efeb.tar.bz2
spack-da9ba2b2549e39b6707c7095a2e97db7e3d3efeb.tar.xz
spack-da9ba2b2549e39b6707c7095a2e97db7e3d3efeb.zip
Add build number to Arm compiler version identification (#15809)
* Add capability for detecting build number for Arm compilers * Fixing fleck8 errors and updating test_arm_version_detection function for more detailed Arm compielr version detection * Ran flake8 locally and corrected errors * Altering Arm compielr version check to remove else clause and be more consistent with other compielr version checks. Added test case so both the 'if' and 'else' conditionals of the Arm compiler version check have a test case Co-authored-by: EC2 Default User <ec2-user@ip-172-31-7-135.us-east-2.compute.internal>
-rw-r--r--lib/spack/spack/compilers/arm.py16
-rw-r--r--lib/spack/spack/test/compilers.py8
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/spack/spack/compilers/arm.py b/lib/spack/spack/compilers/arm.py
index ffce1e2b01..ca17ff42e8 100644
--- a/lib/spack/spack/compilers/arm.py
+++ b/lib/spack/spack/compilers/arm.py
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import spack.compiler
+import re
class Arm(spack.compiler.Compiler):
@@ -35,7 +36,20 @@ class Arm(spack.compiler.Compiler):
# InstalledDir:
# /opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin
version_argument = '--version'
- version_regex = r'Arm C\/C\+\+\/Fortran Compiler version ([^ )]+)'
+ version_regex = r'Arm C\/C\+\+\/Fortran Compiler version ([\d\.]+) '\
+ r'\(build number (\d+)\) '
+
+ @classmethod
+ def extract_version_from_output(cls, output):
+ """Extracts the version from compiler's output."""
+ match = re.search(cls.version_regex, output)
+ temp = 'unknown'
+ if match:
+ if match.group(1).count('.') == 1:
+ temp = match.group(1) + ".0." + match.group(2)
+ else:
+ temp = match.group(1) + "." + match.group(2)
+ return temp
@classmethod
def verbose_flag(cls):
diff --git a/lib/spack/spack/test/compilers.py b/lib/spack/spack/test/compilers.py
index 51eedd748f..13e3d9e695 100644
--- a/lib/spack/spack/test/compilers.py
+++ b/lib/spack/spack/test/compilers.py
@@ -369,7 +369,13 @@ def test_clang_version_detection(version_str, expected_version):
'Thread model: posix\n'
'InstalledDir:\n'
'/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n', # NOQA
- '19.0')
+ '19.0.0.73'),
+ ('Arm C/C++/Fortran Compiler version 19.3.1 (build number 75) (based on LLVM 7.0.2)\n' # NOQA
+ 'Target: aarch64--linux-gnu\n'
+ 'Thread model: posix\n'
+ 'InstalledDir:\n'
+ '/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n', # NOQA
+ '19.3.1.75')
])
def test_arm_version_detection(version_str, expected_version):
version = spack.compilers.arm.Arm.extract_version_from_output(version_str)