CI: switch qubes runners to use console.exp

It appears as sometimes it takes more time for Xen even start booting,
mostly due to firmware and fetching large boot files by grub. In some
jobs the current timeout is pretty close to the actual time needed, and
sometimes (rarely for now) test fails due to timeout expiring in the
middle of dom0 booting. This will be happening more often if the
initramfs will grow (and with more complex tests).
This has been observed on some dom0pvh-hvm jobs, at least on runners hw3
and hw11.

Switch to using expect (console.exp) for more robust test output
handling. This allows waiting separately for Xen starting to boot and
then for the test to complete. For now, set both of those to 120s, which
pessimistically bumps timeout for the whole test to 240s (from 120s).

Add S3 handling to console.exp via SUSPEND_MSG + WAKEUP_CMD.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
(cherry picked from commit d604d774a2)
This commit is contained in:
Marek Marczykowski-Górecki authored and Andrew Cooper committed 2025-05-09 22:45:20 +01:00
1 parent cada2a89a8
commit 62cba67338
3 files changed
+27 -39

No files matched your search

@@ -48,3 +48,4 @@ RUN apk --no-cache add \
# qubes test deps
openssh-client \
fakeroot \
expect \
+13
View File
@@ -9,6 +9,10 @@
# tests that's a command to read serial console
# - UBOOT_CMD (optional): command to enter at u-boot prompt
# - BOOT_MSG (optional): initial Xen message to wait for (aka sign-of-life)
# - SUSPEND_MSG (optional): message signaling system is going to sleep, it's
# trigger for WAKEUP_CMD (see below)
# - WAKEUP_CMD (optional): command to execute to wakeup the system 30s after
# seeing SUSPEND_MSG
# - LOG_MSG (optional): final console message to wait for
# - PASSED: message to look for to consider test a success; if LOG_MSG is set,
# both LOG_MSG and PASSED must appear (in any order) for test to succeed
@@ -45,6 +49,15 @@ if {[info exists env(BOOT_MSG)]} {
expect -re "$env(BOOT_MSG)"
}
if {[info exists env(WAKEUP_CMD)]} {
expect -re "$env(SUSPEND_MSG)"
# keep it suspended a bit, then wakeup
sleep 30
system "$env(WAKEUP_CMD)"
}
if {[info exists env(LOG_MSG)]} {
expect {
-notransfer -re "$env(PASSED)" {
+13 -39
View File
@@ -1,6 +1,6 @@
#!/bin/sh
set -ex
set -ex -o pipefail
# One of:
# - "" PV dom0, PVH domU
@@ -267,52 +267,26 @@ cp -f binaries/xen $TFTP/xen
cp -f binaries/bzImage $TFTP/vmlinuz
cp -f binaries/dom0-rootfs.cpio.gz $TFTP/initrd-dom0
# start logging the serial; this gives interactive console, don't close its
# stdin to not close it; the 'cat' is important, plain redirection would hang
# until somebody opens the pipe; opening and closing the pipe is used to close
# the console
mkfifo /tmp/console-stdin
cat /tmp/console-stdin |\
ssh $CONTROLLER console | tee smoke.serial | sed 's/\r//' &
# start the system pointing at gitlab-ci predefined config
ssh $CONTROLLER gitlabci poweron
trap "ssh $CONTROLLER poweroff; : > /tmp/console-stdin" EXIT
trap "ssh $CONTROLLER poweroff" EXIT
if [ -n "$wait_and_wakeup" ]; then
# wait for suspend or a timeout
until grep "$wait_and_wakeup" smoke.serial || [ $timeout -le 0 ]; do
sleep 1;
: $((--timeout))
done
if [ $timeout -le 0 ]; then
echo "ERROR: suspend timeout, aborting"
exit 1
fi
# keep it suspended a bit, then wakeup
sleep 30
ssh $CONTROLLER wake
export SUSPEND_MSG="$wait_and_wakeup"
export WAKEUP_CMD="ssh $CONTROLLER wake"
fi
set +x
until grep "^Welcome to Alpine Linux" smoke.serial || [ $timeout -le 0 ]; do
sleep 1;
: $((--timeout))
done
set -x
tail -n 100 smoke.serial
if [ $timeout -le 0 ]; then
echo "ERROR: test timeout, aborting"
exit 1
fi
export PASSED="${passed}"
export BOOT_MSG="Latest ChangeSet: "
export LOG_MSG="\nWelcome to Alpine Linux"
export TEST_CMD="ssh $CONTROLLER console"
export TEST_LOG="smoke.serial"
export TEST_TIMEOUT="$timeout"
./automation/scripts/console.exp | sed 's/\r\+$//'
TEST_RESULT=$?
if [ -n "$retrieve_xml" ]; then
nc -w 10 "$SUT_ADDR" 8080 > tests-junit.xml </dev/null
fi
sleep 1
(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
exit 0
exit "$TEST_RESULT"
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.