Skip to content

Commit e765952

Browse files
committed
Dump logs when e2e fails in CI
1 parent a758230 commit e765952

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ test: $(BUILD_DIRS)
248248
/bin/sh -c " \
249249
./build/test.sh ./... \
250250
"
251-
./test_e2e.sh
251+
VERBOSE=1 ./test_e2e.sh
252252

253253
TEST_TOOLS := $(shell find _test_tools/* -type d -printf "%f ")
254254
test-tools: $(foreach tool, $(TEST_TOOLS), .container-test_tool.$(tool))

test_e2e.sh

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,21 +3291,17 @@ make container REGISTRY=e2e VERSION="${E2E_TAG}" ALLOW_STALE_APT=1
32913291
make test-tools REGISTRY=e2e
32923292

32933293
function finish() {
3294-
r=$?
3295-
trap "" INT EXIT ERR
3296-
if [[ $r != 0 ]]; then
3297-
echo
3298-
echo "the directory $DIR was not removed as it contains"\
3299-
"log files useful for debugging"
3300-
fi
3301-
exit $r
3294+
r=$?
3295+
trap "" INT EXIT ERR
3296+
if [[ $r != 0 ]]; then
3297+
echo
3298+
echo "the directory $DIR was not removed as it contains"\
3299+
"log files useful for debugging"
3300+
fi
3301+
exit $r
33023302
}
33033303
trap finish INT EXIT ERR
33043304

3305-
echo
3306-
echo "test root is $DIR"
3307-
echo
3308-
33093305
# Run a test function and return its error code. This is needed because POSIX
33103306
# dictates that `errexit` does not apply inside a function called in an `if`
33113307
# context. But if we don't call it with `if`, then it terminates the whole
@@ -3345,10 +3341,24 @@ umask 0002
33453341
# Mark all repos as safe, to avoid "dubious ownership".
33463342
git config --global --add safe.directory '*'
33473343

3348-
# Iterate over the chosen tests and run them.
33493344
FAILS=()
33503345
FINAL_RET=0
33513346
RUNS="${RUNS:-1}"
3347+
3348+
echo
3349+
echo "test root is $DIR"
3350+
if (( "${RUNS}" > 1 )); then
3351+
echo " RUNS=$RUNS"
3352+
fi
3353+
if [[ "${CLEANUP:-}" == 0 ]]; then
3354+
echo " CLEANUP disabled"
3355+
fi
3356+
if [[ -n "${VERBOSE:-}" ]]; then
3357+
echo " VERBOSE enabled"
3358+
fi
3359+
echo
3360+
3361+
# Iterate over the chosen tests and run them.
33523362
for t; do
33533363
TEST_RET=0
33543364
RUN=0
@@ -3377,6 +3387,13 @@ for t; do
33773387
if [[ "$RUN_RET" != 42 ]]; then
33783388
echo "FAIL: unknown error"
33793389
fi
3390+
if [[ -n "${VERBOSE:-}" ]]; then
3391+
echo -ne "\n\n"
3392+
echo "LOG ----------------------"
3393+
cat "${LOG}.${RUN}"
3394+
echo "--------------------------"
3395+
echo -ne "\n\n"
3396+
fi
33803397
fi
33813398
remove_containers || true
33823399
RUN=$((RUN+1))

0 commit comments

Comments
 (0)