tests/cmake: convert to new stand-alone test process (#37724)

This commit is contained in:
Tamara Dahlgren 2023-05-28 00:59:21 -07:00 committed by GitHub
parent 582ebee74c
commit 8df036a5a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -436,17 +436,28 @@ def setup_dependent_package(self, module, dependent_spec):
module.cmake = Executable(self.spec.prefix.bin.cmake) module.cmake = Executable(self.spec.prefix.bin.cmake)
module.ctest = Executable(self.spec.prefix.bin.ctest) module.ctest = Executable(self.spec.prefix.bin.ctest)
def test(self): def run_version_check(self, bin):
"""Perform smoke tests on the installed package.""" """Runs and checks output of the installed binary."""
spec_vers_str = "version {0}".format(self.spec.version) exe_path = join_path(self.prefix.bin, bin)
if not os.path.exists(exe_path):
raise SkipTest(f"{exe} is not installed")
for exe in ["ccmake", "cmake", "cpack", "ctest"]: exe = which(exe_path)
reason = "test version of {0} is {1}".format(exe, spec_vers_str) out = exe("--version", output=str.split, error=str.split)
self.run_test( assert f"version {self.spec.version}" in out
exe,
["--version"], def test_ccmake(self):
[spec_vers_str], """check version from ccmake"""
installed=True, self.run_version_check("ccmake")
purpose=reason,
skip_missing=True, def test_cmake(self):
) """check version from cmake"""
self.run_version_check("cmake")
def test_cpack(self):
"""check version from cpack"""
self.run_version_check("cpack")
def test_ctest(self):
"""check version from ctest"""
self.run_version_check("ctest")