Skip to content

Commit 4f0bc75

Browse files
ax3lEZoni
andauthored
CMake/CTest: Opt-in Disable Signal Handling (#5550)
In IDEs, we want to attach debuggers to CTest runs. This needs an option to [disable signal handling from AMReX](https://amrex-codes.github.io/amrex/docs_html/Debugging.html#breaking-into-debuggers) to work. --------- Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
1 parent 554a2ff commit 4f0bc75

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

.azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
df -h
142142
# configure
143143
export AMReX_CMAKE_FLAGS="-DAMReX_ASSERTIONS=ON -DAMReX_TESTING=ON"
144-
export WARPX_TEST_FLAGS="-DWarpX_TEST_CLEANUP=ON -DWarpX_TEST_FPETRAP=ON -DWarpX_TEST_DEBUG=ON"
144+
export WARPX_TEST_FLAGS="-DWarpX_TEST_CLEANUP=ON -DWarpX_TEST_FPETRAP=ON -DWarpX_BACKTRACE_INFO=ON"
145145
cmake -S . -B build \
146146
${AMReX_CMAKE_FLAGS} \
147147
${WARPX_CMAKE_FLAGS} \

CMakeLists.txt

+10-9
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,19 @@ option(WarpX_QED_TABLE_GEN "QED table generation (requires PICSAR and Boost)"
8181
option(WarpX_QED_TOOLS "Build external tool to generate QED lookup tables (requires PICSAR and Boost)"
8282
OFF)
8383

84-
# Advanced option to automatically clean up CI test directories
85-
option(WarpX_TEST_CLEANUP "Clean up CI test directories" OFF)
84+
# Advanced option to run tests
85+
option(WarpX_TEST_CLEANUP "Clean up automated test directories" OFF)
86+
option(WarpX_TEST_DEBUGGER "Run automated tests without AMReX signal handling (to attach debuggers)" OFF)
87+
option(WarpX_TEST_FPETRAP "Run automated tests with FPE-trapping runtime parameters" OFF)
8688
mark_as_advanced(WarpX_TEST_CLEANUP)
87-
88-
# Advanced option to run CI tests with FPE-trapping runtime parameters
89-
option(WarpX_TEST_FPETRAP "Run CI tests with FPE-trapping runtime parameters" OFF)
89+
mark_as_advanced(WarpX_TEST_DEBUGGER)
9090
mark_as_advanced(WarpX_TEST_FPETRAP)
9191

92-
# Advanced option to run CI tests with the -g compile option
93-
option(WarpX_TEST_DEBUG "Run CI tests with the -g compile option" OFF)
94-
mark_as_advanced(WarpX_TEST_DEBUG)
95-
if(WarpX_TEST_DEBUG)
92+
# Advanced option to compile with the -g1 option for minimal debug symbols
93+
# (useful to see, e.g., line numbers in backtraces)
94+
option(WarpX_BACKTRACE_INFO "Compile with -g1 for minimal debug symbols (currently used in CI tests)" OFF)
95+
mark_as_advanced(WarpX_BACKTRACE_INFO)
96+
if(WarpX_BACKTRACE_INFO)
9697
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g1")
9798
endif()
9899

Docs/source/install/cmake.rst

+4
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ CMake Option Default & Values Des
143143
``WarpX_pybind11_repo`` ``https://github.com/pybind/pybind11.git`` Repository URI to pull and build pybind11 from
144144
``WarpX_pybind11_branch`` *we set and maintain a compatible commit* Repository branch for ``WarpX_pybind11_repo``
145145
``WarpX_pybind11_internal`` **ON**/OFF Needs a pre-installed pybind11 library if set to ``OFF``
146+
``WarpX_TEST_CLEANUP`` ON/**OFF** Clean up automated test directories
147+
``WarpX_TEST_DEBUGGER`` ON/**OFF** Run automated tests without AMReX signal handling (to attach debuggers)
148+
``WarpX_TEST_FPETRAP`` ON/**OFF** Run automated tests with FPE-trapping runtime parameters
149+
``WarpX_BACKTRACE_INFO`` ON/**OFF** Compile with -g1 for minimal debug symbols (currently used in CI tests)
146150
============================= ============================================== ===========================================================
147151

148152
For example, one can also build against a local AMReX copy.

Examples/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ function(add_warpx_test
159159
"amrex.fpe_trap_zero = 1"
160160
)
161161
endif()
162+
if(WarpX_TEST_DEBUGGER)
163+
set(runtime_params_fpetrap "amrex.signal_handling = 0")
164+
endif()
162165
add_test(
163166
NAME ${name}.run
164167
COMMAND

0 commit comments

Comments
 (0)