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:
		| @@ -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] | ||||
|   | ||||
| @@ -14,18 +14,16 @@ class Fortran(Package): | ||||
|     homepage = "https://wg5-fortran.org/" | ||||
|     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 | ||||
| 
 | ||||
|         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) | ||||
|   | ||||
| @@ -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") | ||||
| 
 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 AcriusWinter
					AcriusWinter