Skip to content

Commit c8c78f4

Browse files
authored
CI: find and print backtraces (#5424)
I think this should work to find and print backtraces after all CI tests have run. This is for Azure only. Local backtraces still need be inspected manually. After trying many solutions, the current strategy is: - avoid removing the backtrace files in the `cleanup` step of each test (we continue to remove all other files); - have a separate workflow step to find and print the backtrace files in the Azure job (this is executed always). The new Azure workflow step is labeled "Logs" and it comes right after the step labeled "Test".
1 parent bae146f commit c8c78f4

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

.azure-pipelines.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
displayName: Cache Python Libraries
7878

7979
- bash: |
80-
set -eu -o pipefail
80+
set -o nounset errexit pipefail
8181
cat /proc/cpuinfo | grep "model name" | sort -u
8282
df -h
8383
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries
@@ -146,25 +146,36 @@ jobs:
146146
displayName: 'Install dependencies'
147147
148148
- bash: |
149-
set -eu -o pipefail
149+
# set options
150+
set -o nounset errexit pipefail
151+
# display disk space usage
150152
df -h
151-
152153
# configure
153154
export AMReX_CMAKE_FLAGS="-DAMReX_ASSERTIONS=ON -DAMReX_TESTING=ON"
154155
cmake -S . -B build \
155156
${AMReX_CMAKE_FLAGS} \
156157
${WARPX_CMAKE_FLAGS} \
157158
-DWarpX_TEST_CLEANUP=ON \
158159
-DWarpX_TEST_FPETRAP=ON
159-
160160
# build
161161
cmake --build build -j 2
162+
# display disk space usage
162163
df -h
163164
displayName: 'Build'
164165
165166
- bash: |
166-
set -eu -o pipefail
167-
167+
# set options
168+
set -o nounset errexit pipefail
168169
# run tests (exclude pytest.AMReX when running Python tests)
169170
ctest --test-dir build --output-on-failure -E AMReX
170171
displayName: 'Test'
172+
173+
- bash: |
174+
# set options
175+
set -o nounset errexit pipefail
176+
# find and print backtrace
177+
find build/bin/ -type f -name "Backtrace*" \
178+
-exec echo -e "\nBacktrace\n---------\n{}\n---------" \; \
179+
-exec cat {} \;
180+
displayName: 'Logs'
181+
condition: always()

Examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function(add_warpx_test
198198
if(WarpX_TEST_CLEANUP)
199199
add_test(
200200
NAME ${name}.cleanup
201-
COMMAND ${CMAKE_COMMAND} -E rm -rf ${THIS_WORKING_DIR}
201+
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/Examples/test_cleanup.cmake ${THIS_WORKING_DIR}
202202
)
203203
# test cleanup depends on test run
204204
set_property(TEST ${name}.cleanup APPEND PROPERTY DEPENDS "${name}.run")

Examples/test_cleanup.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# delete all test files except backtrace
2+
file(GLOB test_files ${CMAKE_ARGV3}/*)
3+
foreach(file ${test_files})
4+
if(NOT ${file} MATCHES "Backtrace*")
5+
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -r ${file})
6+
endif()
7+
endforeach()

0 commit comments

Comments
 (0)