Skip to content

Commit e761ef1

Browse files
committed
Handle CTest exit status correctly
1 parent 60e2316 commit e761ef1

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

.azure-pipelines.yml

Lines changed: 16 additions & 17 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,37 +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
170-
ctest_exit_status=$?
171+
displayName: 'Test'
171172
172-
# find and print backtraces (regardless of CTest exit status)
173+
- bash: |
174+
# set options
175+
set -o nounset errexit pipefail
176+
# find and print backtrace
173177
find build/bin/ -type f -name "Backtrace*" \
174-
-exec echo -e "\nBacktrace\n---------\n{}\n---------" \; \
175-
-exec cat {} \; \
176-
-exec echo -e "\n" \;
177-
178-
# exit program based on CTest exit status
179-
if (( ${ctest_exit_status} != 0 )); then
180-
exit ${ctest_exit_status}
181-
fi
182-
displayName: 'Test'
178+
-exec echo -e "\nBacktrace\n---------\n{}\n---------" \; \
179+
-exec cat {} \;
180+
displayName: 'Logs'
181+
condition: always()

0 commit comments

Comments
 (0)