diff options
author | AcriusWinter <152348900+AcriusWinter@users.noreply.github.com> | 2024-08-11 13:32:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-11 14:32:39 -0600 |
commit | 7ce5ac1e6e561a658ab1cf7863366c561ed86914 (patch) | |
tree | 3103db93adbc6d1093f53db564a662ee7e900aaf | |
parent | 565165f02d2f74ec28b4cb088ea2dc5ba93d238d (diff) | |
download | spack-7ce5ac1e6e561a658ab1cf7863366c561ed86914.tar.gz spack-7ce5ac1e6e561a658ab1cf7863366c561ed86914.tar.bz2 spack-7ce5ac1e6e561a658ab1cf7863366c561ed86914.tar.xz spack-7ce5ac1e6e561a658ab1cf7863366c561ed86914.zip |
fortran: new test API (#45470)
* fortran: new test API
* fortran: add provides to gcc package
* fortran: simplify stand-alone test processing
---------
Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
-rw-r--r-- | etc/spack/defaults/packages.yaml | 1 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/fortran/package.py | 24 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/gcc/package.py | 1 |
3 files changed, 13 insertions, 13 deletions
diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml index 38bc2014d5..3056cbb5d5 100644 --- a/etc/spack/defaults/packages.yaml +++ b/etc/spack/defaults/packages.yaml @@ -26,6 +26,7 @@ packages: elf: [elfutils] fftw-api: [fftw, amdfftw] flame: [libflame, amdlibflame] + fortran: [gcc] fortran-rt: [gcc-runtime, intel-oneapi-runtime] fuse: [libfuse] gl: [glx, osmesa] diff --git a/var/spack/repos/builtin/packages/fortran/package.py b/var/spack/repos/builtin/packages/fortran/package.py index 082d1224c6..df1d30cf20 100644 --- a/var/spack/repos/builtin/packages/fortran/package.py +++ b/var/spack/repos/builtin/packages/fortran/package.py @@ -14,18 +14,16 @@ class Fortran(Package): homepage = "https://wg5-fortran.org/" virtual = True - def test(self): - test_source = self.test_suite.current_test_data_dir + def test_fortran(self): + """Compile and run 'Hello world'""" + expected = ["Hello world", "YES!"] + fc = which(os.environ["FC"]) + test_source = self.test_suite.current_test_data_dir for test in os.listdir(test_source): - filepath = os.path.join(test_source, test) - exe_name = "%s.exe" % test - - fc_exe = os.environ["FC"] - fc_opts = ["-o", exe_name, filepath] - - compiled = self.run_test(fc_exe, options=fc_opts, installed=True) - - if compiled: - expected = ["Hello world", "YES!"] - self.run_test(exe_name, expected=expected) + exe_name = f"{test}.exe" + with test_part(self, f"test_fortran_{test}", f"run {exe_name}"): + fc("-o", exe_name, join_path(test_source, test)) + exe = which(exe_name) + out = exe(output=str.split, error=str.split) + check_outputs(expected, out) diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index 0a91eb83d8..d57c57526d 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -35,6 +35,7 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage, CompilerPackage): license("GPL-2.0-or-later AND LGPL-2.1-or-later") provides("cxx") + provides("fortran") version("master", branch="master") |