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>
This commit is contained in:
AcriusWinter 2024-08-11 13:32:39 -07:00 committed by GitHub
parent 565165f02d
commit 7ce5ac1e6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 13 deletions

View File

@ -26,6 +26,7 @@ packages:
elf: [elfutils] elf: [elfutils]
fftw-api: [fftw, amdfftw] fftw-api: [fftw, amdfftw]
flame: [libflame, amdlibflame] flame: [libflame, amdlibflame]
fortran: [gcc]
fortran-rt: [gcc-runtime, intel-oneapi-runtime] fortran-rt: [gcc-runtime, intel-oneapi-runtime]
fuse: [libfuse] fuse: [libfuse]
gl: [glx, osmesa] gl: [glx, osmesa]

View File

@ -14,18 +14,16 @@ class Fortran(Package):
homepage = "https://wg5-fortran.org/" homepage = "https://wg5-fortran.org/"
virtual = True virtual = True
def test(self): 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 test_source = self.test_suite.current_test_data_dir
for test in os.listdir(test_source): for test in os.listdir(test_source):
filepath = os.path.join(test_source, test) exe_name = f"{test}.exe"
exe_name = "%s.exe" % test with test_part(self, f"test_fortran_{test}", f"run {exe_name}"):
fc("-o", exe_name, join_path(test_source, test))
fc_exe = os.environ["FC"] exe = which(exe_name)
fc_opts = ["-o", exe_name, filepath] out = exe(output=str.split, error=str.split)
check_outputs(expected, out)
compiled = self.run_test(fc_exe, options=fc_opts, installed=True)
if compiled:
expected = ["Hello world", "YES!"]
self.run_test(exe_name, expected=expected)

View File

@ -35,6 +35,7 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage, CompilerPackage):
license("GPL-2.0-or-later AND LGPL-2.1-or-later") license("GPL-2.0-or-later AND LGPL-2.1-or-later")
provides("cxx") provides("cxx")
provides("fortran")
version("master", branch="master") version("master", branch="master")