Skip to content

Commit

Permalink
Use CMake to set default values for RELATIVE_RESTART_TOLERANCE and AB…
Browse files Browse the repository at this point in the history
…SOLUTE_RESTART_TOLERANCE

Use CMake to set default values for RELATIVE_RESTART_TOLERANCE and ABSOLUTE_RESTART_TOLERANCE if environment variables are missing

See merge request gysela-developpers/gyselalibxx!462

--------------------------------------------
  • Loading branch information
EmilyBourne committed Apr 17, 2024
1 parent e2a284b commit e0c07f9
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 13 deletions.
14 changes: 12 additions & 2 deletions tests/geometryXVx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.15)

include(GoogleTest)

foreach(GEOMETRY_VARIANT IN LISTS GEOMETRY_XVx_VARIANTS_LIST)
Expand Down Expand Up @@ -69,6 +67,18 @@ target_sources(unit_tests_xperiod_vx

target_sources(unit_tests_xnonperiod_vx PRIVATE femnonperiodicpoissonsolver.cpp)

# Set variables for restart tests
if (DEFINED ENV{RELATIVE_RESTART_TOLERANCE})
set(RELATIVE_RESTART_TOLERANCE $ENV{RELATIVE_RESTART_TOLERANCE})
else()
set(RELATIVE_RESTART_TOLERANCE "1e-14")
endif()
if (DEFINED ENV{ABSOLUTE_RESTART_TOLERANCE})
set(ABSOLUTE_RESTART_TOLERANCE $ENV{ABSOLUTE_RESTART_TOLERANCE})
else()
set(ABSOLUTE_RESTART_TOLERANCE "1e-14")
endif()

add_subdirectory(bump_on_tail)

add_subdirectory(geometryMX)
Expand Down
8 changes: 6 additions & 2 deletions tests/geometryXVx/bump_on_tail/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ add_test(NAME TestSimulationBumpontailRestartFFT_XVx
"${PROJECT_SOURCE_DIR}"
"$<TARGET_FILE:bumpontail_fft>"
"$<TARGET_FILE:Python3::Interpreter>"
"restart")
"restart"
"${RELATIVE_RESTART_TOLERANCE}"
"${ABSOLUTE_RESTART_TOLERANCE}")
set_property(TEST TestSimulationBumpontailRestartFFT_XVx PROPERTY TIMEOUT 200)
set_property(TEST TestSimulationBumpontailRestartFFT_XVx PROPERTY COST 100)
set_tests_properties(TestSimulationBumpontailRestartFFT_XVx PROPERTIES LABELS "ResultsNotTested" )
Expand All @@ -35,7 +37,9 @@ add_test(NAME TestSimulationBumpontailRestartFemUniform_xperiod_vx
"${PROJECT_SOURCE_DIR}"
"$<TARGET_FILE:bumpontail_fem_uniform_xperiod_vx>"
"$<TARGET_FILE:Python3::Interpreter>"
"restart")
"restart"
"${RELATIVE_RESTART_TOLERANCE}"
"${ABSOLUTE_RESTART_TOLERANCE}")
set_property(TEST TestSimulationBumpontailRestartFemUniform_xperiod_vx PROPERTY TIMEOUT 200)
set_property(TEST TestSimulationBumpontailRestartFemUniform_xperiod_vx PROPERTY COST 100)
set_tests_properties(TestSimulationBumpontailRestartFemUniform_xperiod_vx PROPERTIES LABELS "ResultsNotTested" )
12 changes: 10 additions & 2 deletions tests/geometryXVx/bump_on_tail/test_bumpontail_restart.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
#!/bin/bash
set -xe

if [ $# -ne 4 ]
if [ $# -lt 4 ] || [ $# -gt 6 ]
then
echo "Usage: $0 <VOICEXX_SRCDIR> <VOICEXX_EXEC> <PYTHON3_EXE> <SIMULATION_NAME>"
echo "Usage: $0 <VOICEXX_SRCDIR> <VOICEXX_EXEC> <PYTHON3_EXE> <SIMULATION_NAME> [<RELATIVE_RESTART_TOLERANCE> <ABSOLUTE_RESTART_TOLERANCE>]"
exit 1
fi
VOICEXX_SRCDIR="$1"
VOICEXX_EXEC="$2"
PYTHON3_EXE="$3"
SIMULATION_NAME="$4"
if [ -n "$5" ]
then
RELATIVE_RESTART_TOLERANCE="$5"
fi
if [ -n "$6" ]
then
ABSOLUTE_RESTART_TOLERANCE="$6"
fi

OUTDIR="${PWD}/${SIMULATION_NAME}"

Expand Down
8 changes: 6 additions & 2 deletions tests/geometryXVx/landau/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ add_test(NAME TestSimulationLandauRestartFFT_XVx
"${PROJECT_SOURCE_DIR}"
"$<TARGET_FILE:landau_fft>"
"$<TARGET_FILE:Python3::Interpreter>"
"restart")
"restart"
"${RELATIVE_RESTART_TOLERANCE}"
"${ABSOLUTE_RESTART_TOLERANCE}")
set_property(TEST TestSimulationLandauRestartFFT_XVx PROPERTY TIMEOUT 200)
set_property(TEST TestSimulationLandauRestartFFT_XVx PROPERTY COST 100)
set_tests_properties(TestSimulationLandauRestartFFT_XVx PROPERTIES LABELS "ResultsNotTested" )
Expand All @@ -35,7 +37,9 @@ add_test(NAME TestSimulationLandauRestartFemUniform_xperiod_vx
"${PROJECT_SOURCE_DIR}"
"$<TARGET_FILE:landau_fem_uniform_xperiod_vx>"
"$<TARGET_FILE:Python3::Interpreter>"
"restart")
"restart"
"${RELATIVE_RESTART_TOLERANCE}"
"${ABSOLUTE_RESTART_TOLERANCE}")
set_property(TEST TestSimulationLandauRestartFemUniform_xperiod_vx PROPERTY TIMEOUT 200)
set_property(TEST TestSimulationLandauRestartFemUniform_xperiod_vx PROPERTY COST 100)
set_tests_properties(TestSimulationLandauRestartFemUniform_xperiod_vx PROPERTIES LABELS "ResultsNotTested" )
12 changes: 10 additions & 2 deletions tests/geometryXVx/landau/test_landau_restart.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
#!/bin/bash
set -xe

if [ $# -ne 4 ]
if [ $# -lt 4 ] || [ $# -gt 6 ]
then
echo "Usage: $0 <VOICEXX_SRCDIR> <VOICEXX_EXEC> <PYTHON3_EXE> <SIMULATION_NAME>"
echo "Usage: $0 <VOICEXX_SRCDIR> <VOICEXX_EXEC> <PYTHON3_EXE> <SIMULATION_NAME> [<RELATIVE_RESTART_TOLERANCE> <ABSOLUTE_RESTART_TOLERANCE>]"
exit 1
fi
VOICEXX_SRCDIR="$1"
VOICEXX_EXEC="$2"
PYTHON3_EXE="$3"
SIMULATION_NAME="$4"
if [ -n "$5" ]
then
RELATIVE_RESTART_TOLERANCE="$5"
fi
if [ -n "$6" ]
then
ABSOLUTE_RESTART_TOLERANCE="$6"
fi

OUTDIR="${PWD}/${SIMULATION_NAME}"

Expand Down
4 changes: 3 additions & 1 deletion tests/geometryXVx/sheath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ add_test(NAME TestSimulationSheathRestart_xperiod_vx
"${PROJECT_SOURCE_DIR}"
"$<TARGET_FILE:sheath_xperiod_vx>"
"$<TARGET_FILE:Python3::Interpreter>"
"restart")
"restart"
"${RELATIVE_RESTART_TOLERANCE}"
"${ABSOLUTE_RESTART_TOLERANCE}")
set_property(TEST TestSimulationSheathRestart_xperiod_vx PROPERTY TIMEOUT 200)
set_property(TEST TestSimulationSheathRestart_xperiod_vx PROPERTY COST 100)
set_tests_properties(TestSimulationSheathRestart_xperiod_vx PROPERTIES LABEL "ResultsNotTested" )
12 changes: 10 additions & 2 deletions tests/geometryXVx/sheath/test_sheath_restart.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
#!/bin/bash
set -xe

if [ $# -ne 4 ]
if [ $# -lt 4 ] || [ $# -gt 6 ]
then
echo "Usage: $0 <VOICEXX_SRCDIR> <VOICEXX_EXEC> <PYTHON3_EXE> <SIMULATION_NAME>"
echo "Usage: $0 <VOICEXX_SRCDIR> <VOICEXX_EXEC> <PYTHON3_EXE> <SIMULATION_NAME> [<RELATIVE_RESTART_TOLERANCE> <ABSOLUTE_RESTART_TOLERANCE>]"
exit 1
fi
VOICEXX_SRCDIR="$1"
VOICEXX_EXEC="$2"
PYTHON3_EXE="$3"
SIMULATION_NAME="$4"
if [ -n "$5" ]
then
RELATIVE_RESTART_TOLERANCE="$5"
fi
if [ -n "$6" ]
then
ABSOLUTE_RESTART_TOLERANCE="$6"
fi

OUTDIR="${PWD}/${SIMULATION_NAME}"

Expand Down

0 comments on commit e0c07f9

Please sign in to comment.