Skip to content

Commit

Permalink
paraview: add simple validation test
Browse files Browse the repository at this point in the history
This uses ParaView's `Examples` directory to test an installed ParaView.
Note that these are only really effective as of 5.11.0-RC2 due to
`Examples` having been untested from the top-level prior to this
(ParaView runs its example directories individually itself).
  • Loading branch information
mathstuf committed Oct 26, 2022
1 parent cc2e1e6 commit ad15859
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
1 change: 1 addition & 0 deletions validation_tests/paraview/build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
paraview-examples/
6 changes: 6 additions & 0 deletions validation_tests/paraview/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

. ./setup.sh

# Remove the examples resources.
rm -rf build/paraview-examples/
64 changes: 64 additions & 0 deletions validation_tests/paraview/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

set -e

#----------------------------------------
# Variables for use later
#----------------------------------------
readonly workdir="build"
paraview_version="$( spack find --format '{version}' "/${PARAVIEW_HASH}" )"
readonly paraview_version
paraview_variants="$( spack find --format '{variants}' "/${PARAVIEW_HASH}" )"
readonly paraview_variants

paraview_has_variant () {
local query="$1"
readonly query

shift

echo "$paraview_variants" | \
grep -q -e "+${query}\>"
}

if paraview_has_variant "shared"; then
paraview_is_shared=true
else
paraview_is_shared=false
fi
readonly paraview_is_shared

#----------------------------------------
# ParaView upstream examples
#----------------------------------------

# First clone ParaView and run its examples.
mkdir -p "$workdir/paraview-examples" # Must be removed in `clean.sh`
pushd "$workdir/paraview-examples"
# We do not need submodules. Also check out the version of ParaView the package
# has to ensure that the examples agree.
git clone --depth 1 -b "v${paraview_version}" https://gitlab.kitware.com/paraview/paraview.git src

paraview_examples_src="$( pwd )/src"
readonly paraview_examples_src

readonly paraview_examples_args=(
"-DCMAKE_PREFIX_PATH=$paraview_ROOT"
"-DBUILD_SHARED_LIBS=$paraview_is_shared"
"$paraview_examples_src/Examples"
)

# Build with Ninja
mkdir build-ninja
pushd build-ninja
cmake -G Ninja "${paraview_examples_args[@]}"
cmake --build .
popd

# Build with Makefiles
mkdir build-make
pushd build-make
cmake -G "Unix Makefiles" "${paraview_examples_args[@]}"
cmake --build .
popd
popd
14 changes: 14 additions & 0 deletions validation_tests/paraview/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -e

#----------------------------------------
# Variables for use later
#----------------------------------------
readonly workdir="build"

#----------------------------------------
# ParaView upstream examples
#----------------------------------------
ctest --output-on-failure --test-dir "$workdir/paraview-examples/build-ninja"
ctest --output-on-failure --test-dir "$workdir/paraview-examples/build-make"
9 changes: 9 additions & 0 deletions validation_tests/paraview/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
. ../../setup.sh

# Actually testing `paraview`
spackLoadUnique paraview@5.11.0-RC3:

# Also need `cmake`, and `ninja` to build test tests.
spackLoadUnique cmake
spackLoadUnique ninja

0 comments on commit ad15859

Please sign in to comment.