Skip to content

Commit

Permalink
paraview: add smoke tests (spack#45759)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicentebolea authored Aug 20, 2024
1 parent c173607 commit 6c26823
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions var/spack/repos/builtin/packages/paraview/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import itertools
import os
import sys
from subprocess import Popen

from spack.package import *

Expand Down Expand Up @@ -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()

0 comments on commit 6c26823

Please sign in to comment.