summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2020-04-17 16:28:51 -0500
committerGitHub <noreply@github.com>2020-04-17 16:28:51 -0500
commit284e450c91f5fdc0a71f6c1f7c2823c84918122f (patch)
tree868961115a2ce1031098e2db7113b043a384d3c8 /lib
parentad8977467bc3949adf3954c1f03c9de715ddf95f (diff)
downloadspack-284e450c91f5fdc0a71f6c1f7c2823c84918122f.tar.gz
spack-284e450c91f5fdc0a71f6c1f7c2823c84918122f.tar.bz2
spack-284e450c91f5fdc0a71f6c1f7c2823c84918122f.tar.xz
spack-284e450c91f5fdc0a71f6c1f7c2823c84918122f.zip
Language-specific PIC flags (#15474)
* Language-specific PIC flags * Add tests for every compiler flag * Fix bad rebase * pic_flag -> cxx_pic_flag
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/autotools.py2
-rw-r--r--lib/spack/spack/compiler.py24
-rw-r--r--lib/spack/spack/compilers/arm.py14
-rw-r--r--lib/spack/spack/compilers/cce.py14
-rw-r--r--lib/spack/spack/compilers/clang.py14
-rw-r--r--lib/spack/spack/compilers/fj.py14
-rw-r--r--lib/spack/spack/compilers/gcc.py14
-rw-r--r--lib/spack/spack/compilers/intel.py14
-rw-r--r--lib/spack/spack/compilers/nag.py6
-rw-r--r--lib/spack/spack/compilers/pgi.py14
-rw-r--r--lib/spack/spack/compilers/xl.py14
-rw-r--r--lib/spack/spack/test/compilers.py233
12 files changed, 300 insertions, 77 deletions
diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py
index 5b4f223d41..6591b6495b 100644
--- a/lib/spack/spack/build_systems/autotools.py
+++ b/lib/spack/spack/build_systems/autotools.py
@@ -169,7 +169,7 @@ class AutotoolsPackage(PackageBase):
line = 'wl="-Wl,"\n'
if line == 'pic_flag=""\n':
line = 'pic_flag="{0}"\n'\
- .format(self.compiler.pic_flag)
+ .format(self.compiler.cc_pic_flag)
sys.stdout.write(line)
@property
diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py
index 9fc7aa51a2..8afbe48c0c 100644
--- a/lib/spack/spack/compiler.py
+++ b/lib/spack/spack/compiler.py
@@ -410,6 +410,30 @@ class Compiler(object):
"the C11 standard",
"c11_flag")
+ @property
+ def cc_pic_flag(self):
+ """Returns the flag used by the C compiler to produce
+ Position Independent Code (PIC)."""
+ return '-fPIC'
+
+ @property
+ def cxx_pic_flag(self):
+ """Returns the flag used by the C++ compiler to produce
+ Position Independent Code (PIC)."""
+ return '-fPIC'
+
+ @property
+ def f77_pic_flag(self):
+ """Returns the flag used by the F77 compiler to produce
+ Position Independent Code (PIC)."""
+ return '-fPIC'
+
+ @property
+ def fc_pic_flag(self):
+ """Returns the flag used by the FC compiler to produce
+ Position Independent Code (PIC)."""
+ return '-fPIC'
+
#
# Compiler classes have methods for querying the version of
# specific compiler executables. This is used when discovering compilers.
diff --git a/lib/spack/spack/compilers/arm.py b/lib/spack/spack/compilers/arm.py
index ca17ff42e8..2f6e195006 100644
--- a/lib/spack/spack/compilers/arm.py
+++ b/lib/spack/spack/compilers/arm.py
@@ -80,7 +80,19 @@ class Arm(spack.compiler.Compiler):
return "-std=c11"
@property
- def pic_flag(self):
+ def cc_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def cxx_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def f77_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def fc_pic_flag(self):
return "-fPIC"
required_libs = ['libclang', 'libflang']
diff --git a/lib/spack/spack/compilers/cce.py b/lib/spack/spack/compilers/cce.py
index 23a1771e9c..7aedb55a5d 100644
--- a/lib/spack/spack/compilers/cce.py
+++ b/lib/spack/spack/compilers/cce.py
@@ -68,5 +68,17 @@ class Cce(Compiler):
'< 8.5')
@property
- def pic_flag(self):
+ def cc_pic_flag(self):
+ return "-h PIC"
+
+ @property
+ def cxx_pic_flag(self):
+ return "-h PIC"
+
+ @property
+ def f77_pic_flag(self):
+ return "-h PIC"
+
+ @property
+ def fc_pic_flag(self):
return "-h PIC"
diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py
index c8df63e533..b14eaa1278 100644
--- a/lib/spack/spack/compilers/clang.py
+++ b/lib/spack/spack/compilers/clang.py
@@ -174,7 +174,19 @@ class Clang(Compiler):
return "-std=c11"
@property
- def pic_flag(self):
+ def cc_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def cxx_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def f77_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def fc_pic_flag(self):
return "-fPIC"
required_libs = ['libclang']
diff --git a/lib/spack/spack/compilers/fj.py b/lib/spack/spack/compilers/fj.py
index 1f7d52f026..54d9308c4a 100644
--- a/lib/spack/spack/compilers/fj.py
+++ b/lib/spack/spack/compilers/fj.py
@@ -59,5 +59,17 @@ class Fj(spack.compiler.Compiler):
return "-std=c11"
@property
- def pic_flag(self):
+ def cc_pic_flag(self):
+ return "-KPIC"
+
+ @property
+ def cxx_pic_flag(self):
+ return "-KPIC"
+
+ @property
+ def f77_pic_flag(self):
+ return "-KPIC"
+
+ @property
+ def fc_pic_flag(self):
return "-KPIC"
diff --git a/lib/spack/spack/compilers/gcc.py b/lib/spack/spack/compilers/gcc.py
index da559d554c..fc9074a67a 100644
--- a/lib/spack/spack/compilers/gcc.py
+++ b/lib/spack/spack/compilers/gcc.py
@@ -110,7 +110,19 @@ class Gcc(Compiler):
return "-std=c11"
@property
- def pic_flag(self):
+ def cc_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def cxx_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def f77_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def fc_pic_flag(self):
return "-fPIC"
required_libs = ['libgcc', 'libgfortran']
diff --git a/lib/spack/spack/compilers/intel.py b/lib/spack/spack/compilers/intel.py
index bc0e44b274..c7d853e3fa 100644
--- a/lib/spack/spack/compilers/intel.py
+++ b/lib/spack/spack/compilers/intel.py
@@ -92,7 +92,19 @@ class Intel(Compiler):
return "-std=c1x"
@property
- def pic_flag(self):
+ def cc_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def cxx_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def f77_pic_flag(self):
+ return "-fPIC"
+
+ @property
+ def fc_pic_flag(self):
return "-fPIC"
@property
diff --git a/lib/spack/spack/compilers/nag.py b/lib/spack/spack/compilers/nag.py
index b7ef2297b8..e5dffa4a67 100644
--- a/lib/spack/spack/compilers/nag.py
+++ b/lib/spack/spack/compilers/nag.py
@@ -41,7 +41,11 @@ class Nag(spack.compiler.Compiler):
return "-std=c++11"
@property
- def pic_flag(self):
+ def f77_pic_flag(self):
+ return "-PIC"
+
+ @property
+ def fc_pic_flag(self):
return "-PIC"
# Unlike other compilers, the NAG compiler passes options to GCC, which
diff --git a/lib/spack/spack/compilers/pgi.py b/lib/spack/spack/compilers/pgi.py
index 7da991754f..13d8f69ec5 100644
--- a/lib/spack/spack/compilers/pgi.py
+++ b/lib/spack/spack/compilers/pgi.py
@@ -46,7 +46,19 @@ class Pgi(Compiler):
return "-std=c++11"
@property
- def pic_flag(self):
+ def cc_pic_flag(self):
+ return "-fpic"
+
+ @property
+ def cxx_pic_flag(self):
+ return "-fpic"
+
+ @property
+ def f77_pic_flag(self):
+ return "-fpic"
+
+ @property
+ def fc_pic_flag(self):
return "-fpic"
required_libs = ['libpgc', 'libpgf90']
diff --git a/lib/spack/spack/compilers/xl.py b/lib/spack/spack/compilers/xl.py
index 36aa4dae7d..46a5002e25 100644
--- a/lib/spack/spack/compilers/xl.py
+++ b/lib/spack/spack/compilers/xl.py
@@ -70,7 +70,19 @@ class Xl(Compiler):
'< 12.1')
@property
- def pic_flag(self):
+ def cc_pic_flag(self):
+ return "-qpic"
+
+ @property
+ def cxx_pic_flag(self):
+ return "-qpic"
+
+ @property
+ def f77_pic_flag(self):
+ return "-qpic"
+
+ @property
+ def fc_pic_flag(self):
return "-qpic"
@property
diff --git a/lib/spack/spack/test/compilers.py b/lib/spack/spack/test/compilers.py
index 13e3d9e695..24115ba562 100644
--- a/lib/spack/spack/test/compilers.py
+++ b/lib/spack/spack/test/compilers.py
@@ -17,13 +17,13 @@ import spack.compilers as compilers
import spack.compilers.arm
import spack.compilers.cce
import spack.compilers.clang
+import spack.compilers.fj
import spack.compilers.gcc
import spack.compilers.intel
import spack.compilers.nag
import spack.compilers.pgi
import spack.compilers.xl
import spack.compilers.xl_r
-import spack.compilers.fj
from spack.compiler import Compiler
@@ -222,18 +222,53 @@ def supported_flag_test(flag, flag_value_ref, spec=None):
# Tests for UnsupportedCompilerFlag exceptions from default
# implementations of flags.
def test_default_flags():
+ supported_flag_test("cc_rpath_arg", "-Wl,-rpath,")
+ supported_flag_test("cxx_rpath_arg", "-Wl,-rpath,")
+ supported_flag_test("f77_rpath_arg", "-Wl,-rpath,")
+ supported_flag_test("fc_rpath_arg", "-Wl,-rpath,")
+ supported_flag_test("linker_arg", "-Wl,")
unsupported_flag_test("openmp_flag")
unsupported_flag_test("cxx11_flag")
unsupported_flag_test("cxx14_flag")
unsupported_flag_test("cxx17_flag")
supported_flag_test("cxx98_flag", "")
+ unsupported_flag_test("c99_flag")
+ unsupported_flag_test("c11_flag")
+ supported_flag_test("cc_pic_flag", "-fPIC")
+ supported_flag_test("cxx_pic_flag", "-fPIC")
+ supported_flag_test("f77_pic_flag", "-fPIC")
+ supported_flag_test("fc_pic_flag", "-fPIC")
# Verify behavior of particular compiler definitions.
-def test_clang_flags():
- # Common
- supported_flag_test("pic_flag", "-fPIC", "gcc@4.0")
+def test_arm_flags():
+ supported_flag_test("openmp_flag", "-fopenmp", "arm@1.0")
+ supported_flag_test("cxx11_flag", "-std=c++11", "arm@1.0")
+ supported_flag_test("cxx14_flag", "-std=c++14", "arm@1.0")
+ supported_flag_test("cxx17_flag", "-std=c++1z", "arm@1.0")
+ supported_flag_test("c99_flag", "-std=c99", "arm@1.0")
+ supported_flag_test("c11_flag", "-std=c11", "arm@1.0")
+ supported_flag_test("cc_pic_flag", "-fPIC", "arm@1.0")
+ supported_flag_test("cxx_pic_flag", "-fPIC", "arm@1.0")
+ supported_flag_test("f77_pic_flag", "-fPIC", "arm@1.0")
+ supported_flag_test("fc_pic_flag", "-fPIC", "arm@1.0")
+
+
+def test_cce_flags():
+ supported_flag_test("openmp_flag", "-h omp", "cce@1.0")
+ supported_flag_test("cxx11_flag", "-h std=c++11", "cce@1.0")
+ unsupported_flag_test("c99_flag", "cce@8.0")
+ supported_flag_test("c99_flag", "-h c99,noconform,gnu", "cce@8.1")
+ supported_flag_test("c99_flag", "-h stc=c99,noconform,gnu", "cce@8.4")
+ unsupported_flag_test("c11_flag", "cce@8.4")
+ supported_flag_test("c11_flag", "-h std=c11,noconform,gnu", "cce@8.5")
+ supported_flag_test("cc_pic_flag", "-h PIC", "cce@1.0")
+ supported_flag_test("cxx_pic_flag", "-h PIC", "cce@1.0")
+ supported_flag_test("f77_pic_flag", "-h PIC", "cce@1.0")
+ supported_flag_test("fc_pic_flag", "-h PIC", "cce@1.0")
+
+def test_clang_flags():
# Apple Clang.
supported_flag_test(
"openmp_flag", "-Xpreprocessor -fopenmp", "clang@2.0.0-apple")
@@ -244,6 +279,13 @@ def test_clang_flags():
supported_flag_test("cxx14_flag", "-std=c++14", "clang@6.1.0-apple")
unsupported_flag_test("cxx17_flag", "clang@6.0.0-apple")
supported_flag_test("cxx17_flag", "-std=c++1z", "clang@6.1.0-apple")
+ supported_flag_test("c99_flag", "-std=c99", "clang@6.1.0-apple")
+ unsupported_flag_test("c11_flag", "clang@6.0.0-apple")
+ supported_flag_test("c11_flag", "-std=c11", "clang@6.1.0-apple")
+ supported_flag_test("cc_pic_flag", "-fPIC", "clang@2.0.0-apple")
+ supported_flag_test("cxx_pic_flag", "-fPIC", "clang@2.0.0-apple")
+ supported_flag_test("f77_pic_flag", "-fPIC", "clang@2.0.0-apple")
+ supported_flag_test("fc_pic_flag", "-fPIC", "clang@2.0.0-apple")
# non-Apple Clang.
supported_flag_test("openmp_flag", "-fopenmp", "clang@3.3")
@@ -255,12 +297,26 @@ def test_clang_flags():
unsupported_flag_test("cxx17_flag", "clang@3.4")
supported_flag_test("cxx17_flag", "-std=c++1z", "clang@3.5")
supported_flag_test("cxx17_flag", "-std=c++17", "clang@5.0")
+ supported_flag_test("c99_flag", "-std=c99", "clang@3.3")
+ unsupported_flag_test("c11_flag", "clang@6.0.0")
+ supported_flag_test("c11_flag", "-std=c11", "clang@6.1.0")
+ supported_flag_test("cc_pic_flag", "-fPIC", "clang@3.3")
+ supported_flag_test("cxx_pic_flag", "-fPIC", "clang@3.3")
+ supported_flag_test("f77_pic_flag", "-fPIC", "clang@3.3")
+ supported_flag_test("fc_pic_flag", "-fPIC", "clang@3.3")
-def test_cce_flags():
- supported_flag_test("openmp_flag", "-h omp", "cce@1.0")
- supported_flag_test("cxx11_flag", "-h std=c++11", "cce@1.0")
- supported_flag_test("pic_flag", "-h PIC", "cce@1.0")
+def test_fj_flags():
+ supported_flag_test("openmp_flag", "-Kopenmp", "fj@4.0.0")
+ supported_flag_test("cxx98_flag", "-std=c++98", "fj@4.0.0")
+ supported_flag_test("cxx11_flag", "-std=c++11", "fj@4.0.0")
+ supported_flag_test("cxx14_flag", "-std=c++14", "fj@4.0.0")
+ supported_flag_test("c99_flag", "-std=c99", "fj@4.0.0")
+ supported_flag_test("c11_flag", "-std=c11", "fj@4.0.0")
+ supported_flag_test("cc_pic_flag", "-KPIC", "fj@4.0.0")
+ supported_flag_test("cxx_pic_flag", "-KPIC", "fj@4.0.0")
+ supported_flag_test("f77_pic_flag", "-KPIC", "fj@4.0.0")
+ supported_flag_test("fc_pic_flag", "-KPIC", "fj@4.0.0")
def test_gcc_flags():
@@ -275,7 +331,17 @@ def test_gcc_flags():
supported_flag_test("cxx14_flag", "-std=c++14", "gcc@4.9")
supported_flag_test("cxx14_flag", "", "gcc@6.0")
unsupported_flag_test("cxx17_flag", "gcc@4.9")
- supported_flag_test("pic_flag", "-fPIC", "gcc@4.0")
+ supported_flag_test("cxx17_flag", "-std=c++1z", "gcc@5.0")
+ supported_flag_test("cxx17_flag", "-std=c++17", "gcc@6.0")
+ unsupported_flag_test("c99_flag", "gcc@4.4")
+ supported_flag_test("c99_flag", "-std=c99", "gcc@4.5")
+ unsupported_flag_test("c11_flag", "gcc@4.6")
+ supported_flag_test("c11_flag", "-std=c11", "gcc@4.7")
+ supported_flag_test("cc_pic_flag", "-fPIC", "gcc@4.0")
+ supported_flag_test("cxx_pic_flag", "-fPIC", "gcc@4.0")
+ supported_flag_test("f77_pic_flag", "-fPIC", "gcc@4.0")
+ supported_flag_test("fc_pic_flag", "-fPIC", "gcc@4.0")
+ supported_flag_test("stdcxx_libs", ("-lstdc++",), "gcc@4.1")
def test_intel_flags():
@@ -287,43 +353,105 @@ def test_intel_flags():
unsupported_flag_test("cxx14_flag", "intel@14.0")
supported_flag_test("cxx14_flag", "-std=c++1y", "intel@15.0")
supported_flag_test("cxx14_flag", "-std=c++14", "intel@15.0.2")
- supported_flag_test("pic_flag", "-fPIC", "intel@1.0")
+ unsupported_flag_test("c99_flag", "intel@11.0")
+ supported_flag_test("c99_flag", "-std=c99", "intel@12.0")
+ unsupported_flag_test("c11_flag", "intel@15.0")
+ supported_flag_test("c11_flag", "-std=c1x", "intel@16.0")
+ supported_flag_test("cc_pic_flag", "-fPIC", "intel@1.0")
+ supported_flag_test("cxx_pic_flag", "-fPIC", "intel@1.0")
+ supported_flag_test("f77_pic_flag", "-fPIC", "intel@1.0")
+ supported_flag_test("fc_pic_flag", "-fPIC", "intel@1.0")
+ supported_flag_test("stdcxx_libs", ("-cxxlib",), "intel@1.0")
def test_nag_flags():
supported_flag_test("openmp_flag", "-openmp", "nag@1.0")
supported_flag_test("cxx11_flag", "-std=c++11", "nag@1.0")
- supported_flag_test("pic_flag", "-PIC", "nag@1.0")
+ supported_flag_test("cc_pic_flag", "-fPIC", "nag@1.0")
+ supported_flag_test("cxx_pic_flag", "-fPIC", "nag@1.0")
+ supported_flag_test("f77_pic_flag", "-PIC", "nag@1.0")
+ supported_flag_test("fc_pic_flag", "-PIC", "nag@1.0")
+ supported_flag_test("cc_rpath_arg", "-Wl,-rpath,", "nag@1.0")
+ supported_flag_test("cxx_rpath_arg", "-Wl,-rpath,", "nag@1.0")
+ supported_flag_test("f77_rpath_arg", "-Wl,-Wl,,-rpath,,", "nag@1.0")
+ supported_flag_test("fc_rpath_arg", "-Wl,-Wl,,-rpath,,", "nag@1.0")
+ supported_flag_test("linker_arg", "-Wl,-Wl,,", "nag@1.0")
def test_pgi_flags():
supported_flag_test("openmp_flag", "-mp", "pgi@1.0")
supported_flag_test("cxx11_flag", "-std=c++11", "pgi@1.0")
- supported_flag_test("pic_flag", "-fpic", "pgi@1.0")
+ unsupported_flag_test("c99_flag", "pgi@12.9")
+ supported_flag_test("c99_flag", "-c99", "pgi@12.10")
+ unsupported_flag_test("c11_flag", "pgi@15.2")
+ supported_flag_test("c11_flag", "-c11", "pgi@15.3")
+ supported_flag_test("cc_pic_flag", "-fpic", "pgi@1.0")
+ supported_flag_test("cxx_pic_flag", "-fpic", "pgi@1.0")
+ supported_flag_test("f77_pic_flag", "-fpic", "pgi@1.0")
+ supported_flag_test("fc_pic_flag", "-fpic", "pgi@1.0")
def test_xl_flags():
supported_flag_test("openmp_flag", "-qsmp=omp", "xl@1.0")
unsupported_flag_test("cxx11_flag", "xl@13.0")
supported_flag_test("cxx11_flag", "-qlanglvl=extended0x", "xl@13.1")
- supported_flag_test("pic_flag", "-qpic", "xl@1.0")
+ unsupported_flag_test("c99_flag", "xl@10.0")
+ supported_flag_test("c99_flag", "-qlanglvl=extc99", "xl@10.1")
+ supported_flag_test("c99_flag", "-std=gnu99", "xl@13.1.1")
+ unsupported_flag_test("c11_flag", "xl@12.0")
+ supported_flag_test("c11_flag", "-qlanglvl=extc1x", "xl@12.1")
+ supported_flag_test("c11_flag", "-std=gnu11", "xl@13.1.2")
+ supported_flag_test("cc_pic_flag", "-qpic", "xl@1.0")
+ supported_flag_test("cxx_pic_flag", "-qpic", "xl@1.0")
+ supported_flag_test("f77_pic_flag", "-qpic", "xl@1.0")
+ supported_flag_test("fc_pic_flag", "-qpic", "xl@1.0")
+ supported_flag_test("fflags", "-qzerosize", "xl@1.0")
def test_xl_r_flags():
supported_flag_test("openmp_flag", "-qsmp=omp", "xl_r@1.0")
unsupported_flag_test("cxx11_flag", "xl_r@13.0")
supported_flag_test("cxx11_flag", "-qlanglvl=extended0x", "xl_r@13.1")
- supported_flag_test("pic_flag", "-qpic", "xl_r@1.0")
+ unsupported_flag_test("c99_flag", "xl_r@10.0")
+ supported_flag_test("c99_flag", "-qlanglvl=extc99", "xl_r@10.1")
+ supported_flag_test("c99_flag", "-std=gnu99", "xl_r@13.1.1")
+ unsupported_flag_test("c11_flag", "xl_r@12.0")
+ supported_flag_test("c11_flag", "-qlanglvl=extc1x", "xl_r@12.1")
+ supported_flag_test("c11_flag", "-std=gnu11", "xl_r@13.1.2")
+ supported_flag_test("cc_pic_flag", "-qpic", "xl_r@1.0")
+ supported_flag_test("cxx_pic_flag", "-qpic", "xl_r@1.0")
+ supported_flag_test("f77_pic_flag", "-qpic", "xl_r@1.0")
+ supported_flag_test("fc_pic_flag", "-qpic", "xl_r@1.0")
+ supported_flag_test("fflags", "-qzerosize", "xl_r@1.0")
-def test_fj_flags():
- supported_flag_test("openmp_flag", "-Kopenmp", "fj@4.0.0")
- supported_flag_test("cxx98_flag", "-std=c++98", "fj@4.0.0")
- supported_flag_test("cxx11_flag", "-std=c++11", "fj@4.0.0")
- supported_flag_test("cxx14_flag", "-std=c++14", "fj@4.0.0")
- supported_flag_test("c99_flag", "-std=c99", "fj@4.0.0")
- supported_flag_test("c11_flag", "-std=c11", "fj@4.0.0")
- supported_flag_test("pic_flag", "-KPIC", "fj@4.0.0")
+@pytest.mark.parametrize('version_str,expected_version', [
+ ('Arm C/C++/Fortran Compiler version 19.0 (build number 73) (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.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)
+ assert version == expected_version
+
+
+@pytest.mark.parametrize('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 Fortran : Version 8.4.6 Mon Apr 15, 2019 12:13:55\n', '8.4.6')
+])
+def test_cce_version_detection(version_str, expected_version):
+ version = spack.compilers.cce.Cce.extract_version_from_output(version_str)
+ assert version == expected_version
@pytest.mark.regression('10191')
@@ -364,21 +492,23 @@ def test_clang_version_detection(version_str, expected_version):
@pytest.mark.parametrize('version_str,expected_version', [
- ('Arm C/C++/Fortran Compiler version 19.0 (build number 73) (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.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')
+ # C compiler
+ ('fcc (FCC) 4.0.0 20190314\n'
+ 'simulating gcc version 6.1\n'
+ 'Copyright FUJITSU LIMITED 2019',
+ '4.0.0'),
+ # C++ compiler
+ ('FCC (FCC) 4.0.0 20190314\n'
+ 'simulating gcc version 6.1\n'
+ 'Copyright FUJITSU LIMITED 2019',
+ '4.0.0'),
+ # Fortran compiler
+ ('frt (FRT) 4.0.0 20190314\n'
+ 'Copyright FUJITSU LIMITED 2019',
+ '4.0.0')
])
-def test_arm_version_detection(version_str, expected_version):
- version = spack.compilers.arm.Arm.extract_version_from_output(version_str)
+def test_fj_version_detection(version_str, expected_version):
+ version = spack.compilers.fj.Fj.extract_version_from_output(version_str)
assert version == expected_version
@@ -454,37 +584,6 @@ def test_xl_version_detection(version_str, expected_version):
assert version == expected_version
-@pytest.mark.parametrize('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 Fortran : Version 8.4.6 Mon Apr 15, 2019 12:13:55\n', '8.4.6')
-])
-def test_cce_version_detection(version_str, expected_version):
- version = spack.compilers.cce.Cce.extract_version_from_output(version_str)
- assert version == expected_version
-
-
-@pytest.mark.parametrize('version_str,expected_version', [
- # C compiler
- ('fcc (FCC) 4.0.0 20190314\n'
- 'simulating gcc version 6.1\n'
- 'Copyright FUJITSU LIMITED 2019',
- '4.0.0'),
- # C++ compiler
- ('FCC (FCC) 4.0.0 20190314\n'
- 'simulating gcc version 6.1\n'
- 'Copyright FUJITSU LIMITED 2019',
- '4.0.0'),
- # Fortran compiler
- ('frt (FRT) 4.0.0 20190314\n'
- 'Copyright FUJITSU LIMITED 2019',
- '4.0.0')
-])
-def test_fj_version_detection(version_str, expected_version):
- version = spack.compilers.fj.Fj.extract_version_from_output(version_str)
- assert version == expected_version
-
-
@pytest.mark.parametrize('compiler_spec,expected_result', [
('gcc@4.7.2', False), ('clang@3.3', False), ('clang@8.0.0', True)
])