Skip to content

Commit

Permalink
timeout: trigger sysrq to help debug
Browse files Browse the repository at this point in the history
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) <[email protected]>
  • Loading branch information
matttbe committed Nov 20, 2024
1 parent 0c138d2 commit ba46718
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -1217,6 +1221,31 @@ run_expect() {

printinfo "Run the virtme script: expect (timeout: ${VIRTME_EXPECT_TEST_TIMEOUT})"

cat <<EOF > "${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 <<EOF > "${VIRTME_RUN_SCRIPT}"
#! /bin/bash
echo -e "$(log_section_start "Boot VM")"
Expand Down

0 comments on commit ba46718

Please sign in to comment.