diy: add smoke test (#45749)

Installing examples for running smoke tests for the DIY project.
This commit is contained in:
Vicente Bolea 2024-08-19 12:04:09 -04:00 committed by GitHub
parent 15413c7258
commit d49f3a0960
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,8 @@ class Diy(CMakePackage):
"""Data-parallel out-of-core library"""
homepage = "https://github.com/diatomic/diy"
maintainers("vicentebolea")
url = "https://github.com/diatomic/diy/archive/3.6.0.tar.gz"
git = "https://github.com/diatomic/diy.git"
@ -23,10 +25,42 @@ class Diy(CMakePackage):
depends_on("mpi")
# https://gitlab.kitware.com/diatomic/diy/-/merge_requests/82
patch(
"https://gitlab.kitware.com/diatomic/diy/-/commit/1d85dd5205b9f0035840e1840a49ea7028618d16.diff",
sha256="047bed205c905064923d7ecf1d03e38c07f3ae0baa0f4afe1b234f68315472d3",
when="@3.6:",
)
def cmake_args(self):
args = [
"-Dbuild_examples=off",
"-Dbuild_tests=off",
"-Dinstall_examples=on",
"-DCMAKE_CXX_COMPILER=%s" % self.spec["mpi"].mpicxx,
]
return args
def test_smoke_test(self):
"""Build and run ctests"""
spec = self.spec
if spec.satisfies("@:3.5"):
raise SkipTest("Smoke test requires DIY>=3.6")
with working_dir("smoke_test_build", create=True):
cmake = Executable(spec["cmake"].prefix.bin.cmake)
ctest = Executable(spec["cmake"].prefix.bin.ctest)
cmake(
spec["diy"].prefix.share.DIY.examples.smoke_test,
f"-DMPI_HOME={spec['mpi'].prefix}",
f"-DCMAKE_PREFIX_PATH={spec['diy'].prefix}",
)
cmake("--build", ".")
ctest("--verbose")
@run_after("install")
@on_package_attributes(run_tests=True)
def build_test(self):
self.test_smoke_test()