From ba467186cb261b20e257ef0efc155d923f907ca1 Mon Sep 17 00:00:00 2001 From: "Matthieu Baerts (NGI0)" Date: Wed, 20 Nov 2024 18:44:09 +0100 Subject: [PATCH] timeout: trigger sysrq to help debug This cycle, some jobs got blocked when running the tests, and the CI didn't show any useful info in case of a timeout. The idea here is to have a simple script running in a background, waiting for the timeout to trigger some sysrq in order to get some useful debug info. Signed-off-by: Matthieu Baerts (NGI0) --- entrypoint.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 45c342b..80e9864 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -95,6 +95,7 @@ VIRTME_HEADERS_DIR="${VIRTME_WORKDIR}/headers" VIRTME_SCRIPT="${VIRTME_SCRIPTS_DIR}/tests.sh" VIRTME_SCRIPT_END="__VIRTME_END__" VIRTME_SCRIPT_UNEXPECTED_STOP="Unexpected stop of the VM" +VIRTME_SCRIPT_TIMEOUT="${VIRTME_SCRIPTS_DIR}/tests.timeout" VIRTME_RUN_SCRIPT="${VIRTME_SCRIPTS_DIR}/virtme.sh" VIRTME_RUN_EXPECT="${VIRTME_SCRIPTS_DIR}/virtme.expect" @@ -732,6 +733,9 @@ if [ "${INPUT_TRACE}" = "1" ]; then set -x fi +# To get debug info for stalled tests +(${VIRTME_SCRIPT_TIMEOUT} &) + # useful for virtme-exec-run TAP_PREFIX="${KERNEL_SRC}/tools/testing/selftests/kselftest/prefix.pl" RESULTS_DIR="${RESULTS_DIR}" @@ -1217,6 +1221,31 @@ run_expect() { printinfo "Run the virtme script: expect (timeout: ${VIRTME_EXPECT_TEST_TIMEOUT})" + cat < "${VIRTME_SCRIPT_TIMEOUT}" +#! /bin/bash +DUMP_SEC=60 +TEST_TIMEOUT=${VIRTME_EXPECT_TEST_TIMEOUT} +if [ \${TEST_TIMEOUT} -le \${DUMP_SEC} ]; then + exit 0 # not needed, nothing to do +fi + +sysrq() { + echo -e "\nsysrq: \${1}\n" + echo "\${1}" > /proc/sysrq-trigger + sleep 1 +} + +SLEEP_TIME=\$((TEST_TIMEOUT - DUMP_SEC)) +sleep \${SLEEP_TIME} +echo +echo "Timeout (\${SLEEP_TIME}sec): getting more info" +sysrq 'w' +sysrq 'd' +sysrq 'l' +sysrq 't' +EOF + chmod +x "${VIRTME_SCRIPT_TIMEOUT}" + cat < "${VIRTME_RUN_SCRIPT}" #! /bin/bash echo -e "$(log_section_start "Boot VM")"