c: new test API (#45469)
* c: new test API * gcc: provides('c') * c: bugfix and simplification of the new stand-alone test method --------- Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
This commit is contained in:
@@ -20,6 +20,7 @@ packages:
|
|||||||
awk: [gawk]
|
awk: [gawk]
|
||||||
armci: [armcimpi]
|
armci: [armcimpi]
|
||||||
blas: [openblas, amdblis]
|
blas: [openblas, amdblis]
|
||||||
|
c: [gcc]
|
||||||
cxx: [gcc]
|
cxx: [gcc]
|
||||||
D: [ldc]
|
D: [ldc]
|
||||||
daal: [intel-oneapi-daal]
|
daal: [intel-oneapi-daal]
|
||||||
|
@@ -14,17 +14,17 @@ class C(Package):
|
|||||||
homepage = "http://open-std.org/JTC1/SC22/WG14/www/standards"
|
homepage = "http://open-std.org/JTC1/SC22/WG14/www/standards"
|
||||||
virtual = True
|
virtual = True
|
||||||
|
|
||||||
def test(self):
|
def test_c(self):
|
||||||
|
"""build and run C examples"""
|
||||||
|
cc = which(os.environ["CC"])
|
||||||
|
expected = ["Hello world", "YES!"]
|
||||||
|
|
||||||
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 = test_source.join(test)
|
exe_name = f"{test}.exe"
|
||||||
exe_name = "%s.exe" % test
|
with test_part(self, f"test_c_{test}", f"build and run {exe_name}"):
|
||||||
|
filepath = join_path(test_source, test)
|
||||||
cc_exe = os.environ["CC"]
|
cc("-o", exe_name, filepath)
|
||||||
cc_opts = ["-o", exe_name, filepath]
|
exe = which(exe_name)
|
||||||
compiled = self.run_test(cc_exe, options=cc_opts, installed=True)
|
out = exe(output=str.split, error=str.split)
|
||||||
|
check_outputs(expected, out)
|
||||||
if compiled:
|
|
||||||
expected = ["Hello world", "YES!"]
|
|
||||||
self.run_test(exe_name, expected=expected)
|
|
||||||
|
@@ -34,6 +34,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("c")
|
||||||
provides("cxx")
|
provides("cxx")
|
||||||
provides("fortran")
|
provides("fortran")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user