Skip to content

Commit

Permalink
CMake/CTest: Opt-in Disable Signal Handling
Browse files Browse the repository at this point in the history
In IDEs, we want to attach debuggers to CTest runs. This needs
an option to disable signal handling from AMReX to work.
  • Loading branch information
ax3l committed Jan 10, 2025
1 parent 0e5b81c commit cfc39f4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ option(WarpX_QED_TABLE_GEN "QED table generation (requires PICSAR and Boost)"
option(WarpX_QED_TOOLS "Build external tool to generate QED lookup tables (requires PICSAR and Boost)"
OFF)

# Advanced option to automatically clean up CI test directories
option(WarpX_TEST_CLEANUP "Clean up CI test directories" OFF)
# Advanced option to run tests
option(WarpX_TEST_CLEANUP "Clean up test directories (for CI)" OFF)
option(WarpX_TEST_DEBUGGER "Run tests without AMReX signal handling (to attach debuggers)" OFF)
option(WarpX_TEST_FPETRAP "Run tests with FPE-trapping runtime parameters (for CI)" OFF)
mark_as_advanced(WarpX_TEST_CLEANUP)

# Advanced option to run CI tests with FPE-trapping runtime parameters
option(WarpX_TEST_FPETRAP "Run CI tests with FPE-trapping runtime parameters" OFF)
mark_as_advanced(WarpX_TEST_DEBUGGER)
mark_as_advanced(WarpX_TEST_FPETRAP)

# Advanced option to run CI tests with the -g compile option
option(WarpX_TEST_DEBUG "Run CI tests with the -g compile option" OFF)
option(WarpX_TEST_DEBUG "Compile tests with -g1 for symbols (for CI)" OFF)
mark_as_advanced(WarpX_TEST_DEBUG)
if(WarpX_TEST_DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g1")
Expand Down
4 changes: 4 additions & 0 deletions Docs/source/install/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ CMake Option Default & Values Des
``WarpX_pybind11_repo`` ``https://github.com/pybind/pybind11.git`` Repository URI to pull and build pybind11 from
``WarpX_pybind11_branch`` *we set and maintain a compatible commit* Repository branch for ``WarpX_pybind11_repo``
``WarpX_pybind11_internal`` **ON**/OFF Needs a pre-installed pybind11 library if set to ``OFF``
``WarpX_TEST_CLEANUP`` ON/**OFF** Clean up test directories (for CI)
``WarpX_TEST_DEBUG`` ON/**OFF** Compile tests with -g1 for symbols (for CI)
``WarpX_TEST_DEBUGGER`` ON/**OFF** Run tests without AMReX signal handling (to attach debuggers)
``WarpX_TEST_FPETRAP`` ON/**OFF** Run tests with FPE-trapping runtime parameters (for CI)
============================= ============================================== ===========================================================

For example, one can also build against a local AMReX copy.
Expand Down
4 changes: 4 additions & 0 deletions Examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function(add_warpx_test
set(runtime_params
"amrex.abort_on_unused_inputs = 1"
"amrex.throw_exception = 1"
"amrex.signal_handling = 0"
"warpx.always_warn_immediately = 1"
"warpx.do_dynamic_scheduling = 0"
"warpx.serialize_initial_conditions = 1"
Expand All @@ -159,6 +160,9 @@ function(add_warpx_test
"amrex.fpe_trap_zero = 1"
)
endif()
if(WarpX_TEST_DEBUGGER)
set(runtime_params_fpetrap "amrex.signal_handling = 0")
endif()
add_test(
NAME ${name}.run
COMMAND
Expand Down

0 comments on commit cfc39f4

Please sign in to comment.