Dump logs when e2e fails in CI

This commit is contained in:
Tim Hockin 2023-09-09 22:34:18 -07:00
parent 310cbaea37
commit 50de3aaeab
2 changed files with 31 additions and 14 deletions

View File

@ -248,7 +248,7 @@ test: $(BUILD_DIRS)
/bin/sh -c " \ /bin/sh -c " \
./build/test.sh ./... \ ./build/test.sh ./... \
" "
./test_e2e.sh VERBOSE=1 ./test_e2e.sh
TEST_TOOLS := $(shell find _test_tools/* -type d -printf "%f ") TEST_TOOLS := $(shell find _test_tools/* -type d -printf "%f ")
test-tools: $(foreach tool, $(TEST_TOOLS), .container-test_tool.$(tool)) test-tools: $(foreach tool, $(TEST_TOOLS), .container-test_tool.$(tool))

View File

@ -3211,10 +3211,6 @@ function finish() {
} }
trap finish INT EXIT ERR trap finish INT EXIT ERR
echo
echo "test root is $DIR"
echo
# Run a test function and return its error code. This is needed because POSIX # Run a test function and return its error code. This is needed because POSIX
# dictates that `errexit` does not apply inside a function called in an `if` # dictates that `errexit` does not apply inside a function called in an `if`
# context. But if we don't call it with `if`, then it terminates the whole # context. But if we don't call it with `if`, then it terminates the whole
@ -3254,10 +3250,24 @@ umask 0002
# Mark all repos as safe, to avoid "dubious ownership". # Mark all repos as safe, to avoid "dubious ownership".
git config --global --add safe.directory '*' git config --global --add safe.directory '*'
# Iterate over the chosen tests and run them.
FAILS=() FAILS=()
FINAL_RET=0 FINAL_RET=0
RUNS="${RUNS:-1}" RUNS="${RUNS:-1}"
echo
echo "test root is $DIR"
if (( "${RUNS}" > 1 )); then
echo " RUNS=$RUNS"
fi
if [[ "${CLEANUP:-}" == 0 ]]; then
echo " CLEANUP disabled"
fi
if [[ -n "${VERBOSE:-}" ]]; then
echo " VERBOSE enabled"
fi
echo
# Iterate over the chosen tests and run them.
for t; do for t; do
TEST_RET=0 TEST_RET=0
RUN=0 RUN=0
@ -3286,6 +3296,13 @@ for t; do
if [[ "$RUN_RET" != 42 ]]; then if [[ "$RUN_RET" != 42 ]]; then
echo "FAIL: unknown error" echo "FAIL: unknown error"
fi fi
if [[ -n "${VERBOSE:-}" ]]; then
echo -ne "\n\n"
echo "LOG ----------------------"
cat "${LOG}.${RUN}"
echo "--------------------------"
echo -ne "\n\n"
fi
fi fi
remove_containers || true remove_containers || true
RUN=$((RUN+1)) RUN=$((RUN+1))