paraview: add smoke tests (#45759)
This commit is contained in:
parent
c1736077bb
commit
6c268234ba
@ -6,6 +6,7 @@
|
||||
import itertools
|
||||
import os
|
||||
import sys
|
||||
from subprocess import Popen
|
||||
|
||||
from spack.package import *
|
||||
|
||||
@ -706,3 +707,54 @@ def use_x11():
|
||||
cmake_args.append(self.define_from_variant("VTKOSPRAY_ENABLE_DENOISER", "raytracing"))
|
||||
|
||||
return cmake_args
|
||||
|
||||
def test_smoke_test(self):
|
||||
"""Simple smoke test for ParaView"""
|
||||
spec = self.spec
|
||||
|
||||
pvserver = Executable(spec["paraview"].prefix.bin.pvserver)
|
||||
pvserver("--help")
|
||||
|
||||
def test_pvpython(self):
|
||||
"""Test pvpython"""
|
||||
spec = self.spec
|
||||
|
||||
if "~python" in spec:
|
||||
raise SkipTest("Package must be installed with +python")
|
||||
|
||||
pvpython = Executable(spec["paraview"].prefix.bin.pvpython)
|
||||
pvpython("-c", "import paraview")
|
||||
|
||||
def test_mpi_ensemble(self):
|
||||
"""Test MPI ParaView Client/Server ensemble"""
|
||||
spec = self.spec
|
||||
|
||||
if "~mpi" in spec or "~python" in spec:
|
||||
raise SkipTest("Package must be installed with +mpi and +python")
|
||||
|
||||
mpirun = spec["mpi"].prefix.bin.mpirun
|
||||
pvserver = spec["paraview"].prefix.bin.pvserver
|
||||
pvpython = Executable(spec["paraview"].prefix.bin.pvpython)
|
||||
|
||||
with working_dir("smoke_test_build", create=True):
|
||||
with Popen(
|
||||
[mpirun, "-np", "3", pvserver, "--mpi", "--force-offscreen-rendering"]
|
||||
) as servers:
|
||||
pvpython(
|
||||
"--force-offscreen-rendering",
|
||||
"-c",
|
||||
"from paraview.simple import *;"
|
||||
"Connect('127.0.0.1');"
|
||||
"sphere = Sphere(ThetaResolution=16, PhiResolution=32);"
|
||||
"sphere_remote = servermanager.Fetch(sphere);"
|
||||
"Show(sphere);"
|
||||
"Render()",
|
||||
)
|
||||
servers.terminate()
|
||||
|
||||
@run_after("install")
|
||||
@on_package_attributes(run_tests=True)
|
||||
def build_test(self):
|
||||
self.test_smoke_test()
|
||||
self.test_pvpython()
|
||||
self.test_mpi_ensemble()
|
||||
|
Loading…
Reference in New Issue
Block a user