Peano
Loading...
Searching...
No Matches
test_exaparty Namespace Reference

Run the ExaParty test cases through pytest. More...

Functions

 exaparty_is_built ()
 Check if the ExaParty libraries exist.
 
 run_script (script)
 Run one ExaParty run script from within its directory.
 
 test_functional (script)
 
 test_physics (script)
 

Variables

 TESTS_DIRECTORY = Path(__file__).resolve().parent
 
 PEANO_ROOT_DIRECTORY = TESTS_DIRECTORY.parent.parent
 
list FUNCTIONAL_TESTS
 
list PHYSICS_TESTS
 

Detailed Description

Run the ExaParty test cases through pytest.

Each ExaParty test case lives in its own directory and ships a run script which generates the code, compiles it, runs the executable and, where available, compares the outcome against a reference. This module runs these scripts one by one. A test passes if its script returns with exit code zero.

All tests are integration tests, i.e. you have to request them explicitly:

python3 -m pytest -m integration tests/exaparty
python3 -m pytest -m "integration and not slow" tests/exaparty
python3 -m pytest -m integration tests/exaparty -k sod-1d

They require a Peano build with –enable-particles –enable-exaparty and are skipped otherwise. The scripts write their generated code, executables and outputs into their own directories, exactly as if you ran them by hand.

Function Documentation

◆ exaparty_is_built()

test_exaparty.exaparty_is_built ( )

Check if the ExaParty libraries exist.

We look into the directories which the generated Makefiles use as well, i.e. PEANO_CMAKE_BUILD_DIR and PEANO_SRC_ROOT_DIR take precedence over the repository this file belongs to.

Definition at line 55 of file test_exaparty.py.

Referenced by run_script().

Here is the caller graph for this function:

◆ run_script()

test_exaparty.run_script (   script)

Run one ExaParty run script from within its directory.

Parameters
scriptstr Path of the run script relative to tests/exaparty.

We run the script through bash with pipefail, as most scripts pipe the executable's output through tee, which otherwise hides a crash. python3 resolves to the interpreter that runs pytest, and src/ is added to the PYTHONPATH, so the generator scripts find Peano's Python API.

Definition at line 72 of file test_exaparty.py.

References exaparty_is_built().

Referenced by test_functional(), and test_physics().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_functional()

test_exaparty.test_functional (   script)

Definition at line 105 of file test_exaparty.py.

References run_script().

Here is the call graph for this function:

◆ test_physics()

test_exaparty.test_physics (   script)

Definition at line 112 of file test_exaparty.py.

References run_script().

Here is the call graph for this function:

Variable Documentation

◆ FUNCTIONAL_TESTS

list test_exaparty.FUNCTIONAL_TESTS
Initial value:
1= [
2 "dastgen-test/run.sh",
3 "test-density-calculation/run.sh",
4 "test-boundary-conditions/periodic_1D/run.sh",
5 "test-boundary-conditions/periodic_2D/run.sh",
6 "test-boundary-conditions/periodic_3D/run.sh",
7 "test-smoothing-length-computation/test-smoothing-length-computation-1D/run.sh",
8 "test-smoothing-length-computation/test-smoothing-length-computation-1D/run_multiscale.sh",
9 "test-smoothing-length-computation/test-smoothing-length-computation-2D/run.sh",
10 "test-smoothing-length-computation/test-smoothing-length-computation-2D/run_multiscale.sh",
11 "test-smoothing-length-computation/test-smoothing-length-computation-3D/run.sh",
12 "test-smoothing-length-computation/test-smoothing-length-computation-3D/run_multiscale.sh",
13]

Definition at line 30 of file test_exaparty.py.

◆ PEANO_ROOT_DIRECTORY

test_exaparty.PEANO_ROOT_DIRECTORY = TESTS_DIRECTORY.parent.parent

Definition at line 28 of file test_exaparty.py.

◆ PHYSICS_TESTS

list test_exaparty.PHYSICS_TESTS
Initial value:
1= [
2 "planet-orbit/run.sh",
3 "hydro-simple-sph-physics/sod-1d/run.sh",
4 "hydro-simple-sph-physics/noh-2d/run_32.sh",
5 "hydro-simple-sph-physics/noh-3d/run_20.sh",
6 "hydro-simple-sph-physics/sedov-1d/run.sh",
7 "hydro-simple-sph-physics/sedov-2d/run.sh",
8 "hydro-simple-sph-physics/sedov-3d/run.sh",
9]

Definition at line 44 of file test_exaparty.py.

◆ TESTS_DIRECTORY

test_exaparty.TESTS_DIRECTORY = Path(__file__).resolve().parent

Definition at line 27 of file test_exaparty.py.