Files
xen/automation/scripts/console.exp
T
Marek Marczykowski-Górecki 62cba67338 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)
2025-05-09 22:45:20 +01:00

82 lines
2.0 KiB
Plaintext
Executable File

#!/usr/bin/env expect
#
# Variables used by this script:
# - TEST_TIMEOUT: timeout between each *_MSG match
# - TEST_TIMEOUT_OVERRIDE: when set, overrides TEST_TIMEOUT
# - TEST_LOG: save console log to this file
# - TEST_CMD: commands that prints test system console output to stdout - in
# qemu tests that's usually qemu itself (with -serial stdio), in hardware
# 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
if {[info exists env(TEST_TIMEOUT_OVERRIDE)]} {
set timeout $env(TEST_TIMEOUT_OVERRIDE)
} elseif {[info exists env(TEST_TIMEOUT)]} {
set timeout $env(TEST_TIMEOUT)
} else {
set timeout 1500
}
log_file -a $env(TEST_LOG)
match_max 10000
eval spawn $env(TEST_CMD)
expect_after {
-re "(.*)\r" {
exp_continue -continue_timer
}
timeout {send_error "ERROR-Timeout!\n"; exit 1}
eof {send_error "ERROR-EOF!\n"; exit 1}
}
if {[info exists env(UBOOT_CMD)]} {
expect "=>"
send "$env(UBOOT_CMD)\r"
}
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)" {
expect -re "$env(LOG_MSG)"
exit 0
}
-notransfer -re "$env(LOG_MSG)" {
expect -re "$env(PASSED)"
exit 0
}
}
}
expect {
-re "$env(PASSED)" {
exit 0
}
}
expect eof