ci: show all logs at the end of a run (#22226)

* ci: show all logs at the end of a run

The current CI won't show the logs on error due to early exit. This will
at least show the logs, although for all tests at once.
This commit is contained in:
dundargoc 2023-02-11 18:16:04 +01:00 committed by GitHub
parent 9668c166e8
commit 3a5dddf24f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 55 deletions

View File

@ -211,6 +211,9 @@ jobs:
- name: Setup common environment variables - name: Setup common environment variables
run: ./.github/workflows/env.sh ${{ matrix.flavor }} run: ./.github/workflows/env.sh ${{ matrix.flavor }}
- name: Create log dir
run: mkdir -p "${LOG_DIR}"
- name: Install apt packages - name: Install apt packages
if: matrix.os == 'linux' if: matrix.os == 'linux'
run: ./.github/scripts/install_deps_ubuntu.sh run: ./.github/scripts/install_deps_ubuntu.sh
@ -242,9 +245,6 @@ jobs:
cmake -B build -G Ninja ${CMAKE_FLAGS} cmake -B build -G Ninja ${CMAKE_FLAGS}
cmake --build build cmake --build build
- name: Prepare sanitizer
run: ./ci/run_tests.sh prepare_sanitizer
- if: "!cancelled()" - if: "!cancelled()"
name: Determine if run should be aborted name: Determine if run should be aborted
id: abort_job id: abort_job
@ -272,6 +272,10 @@ jobs:
name: Installtests name: Installtests
run: ./ci/run_tests.sh installtests run: ./ci/run_tests.sh installtests
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: Show logs
run: cat $(find "$LOG_DIR" -type f)
old_cmake: old_cmake:
name: Test oldest supported cmake name: Test oldest supported cmake
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04

View File

@ -19,10 +19,8 @@ check_core_dumps() {
local cores local cores
if test "${CI_OS_NAME}" = osx; then if test "${CI_OS_NAME}" = osx; then
cores="$(find /cores/ -type f -print)" cores="$(find /cores/ -type f -print)"
local _sudo='sudo'
else else
cores="$(find ./ -type f \( -name 'core.*' -o -name core -o -name nvim.core \) -print)" cores="$(find ./ -type f \( -name 'core.*' -o -name core -o -name nvim.core \) -print)"
local _sudo=
fi fi
if test -z "${cores}"; then if test -z "${cores}"; then
@ -36,40 +34,6 @@ check_core_dumps() {
exit 1 exit 1
} }
check_logs() {
# Iterate through each log to remove an useless warning.
# shellcheck disable=SC2044
for log in $(find "${1}" -type f -name "${2}"); do
sed -i "${log}" \
-e '/Warning: noted but unhandled ioctl/d' \
-e '/could cause spurious value errors to appear/d' \
-e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d'
done
# Now do it again, but only consider files with size > 0.
local err=""
# shellcheck disable=SC2044
for log in $(find "${1}" -type f -name "${2}" -size +0); do
cat "${log}"
err=1
rm "${log}"
done
if test -n "${err}"; then
echo 'Runtime errors detected.'
exit 1
fi
}
valgrind_check() {
check_logs "${1}" "valgrind-*"
}
check_sanitizer() {
if test -n "${CLANG_SANITIZER}"; then
check_logs "${1}" "*san.*" | cat
fi
}
unittests() {( unittests() {(
ulimit -c unlimited || true ulimit -c unlimited || true
ninja -C "${BUILD_DIR}" unittest || exit ninja -C "${BUILD_DIR}" unittest || exit
@ -79,8 +43,6 @@ unittests() {(
functionaltests() {( functionaltests() {(
ulimit -c unlimited || true ulimit -c unlimited || true
ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}" || exit ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}" || exit
check_sanitizer "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps check_core_dumps
)} )}
@ -90,8 +52,6 @@ oldtests() {(
reset reset
exit 1 exit 1
fi fi
check_sanitizer "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps check_core_dumps
)} )}
@ -144,16 +104,4 @@ installtests() {(
fi fi
)} )}
prepare_sanitizer() {
# Invoke nvim to trigger *San early.
if ! ("${BUILD_DIR}"/bin/nvim --version && "${BUILD_DIR}"/bin/nvim -u NONE -e -cq | cat -vet); then
check_sanitizer "${LOG_DIR}"
exit 1
fi
check_sanitizer "${LOG_DIR}"
}
rm -rf "${LOG_DIR}"
mkdir -p "${LOG_DIR}"
eval "$*" || exit eval "$*" || exit