Files
xen/automation/scripts/qemu-key.exp
T
Stefano Stabellini 1db6ce307b automation: use expect to run QEMU
Use expect to invoke QEMU so that we can terminate the test as soon as
we get the right string in the output instead of waiting until the
final timeout.

For timeout, instead of an hardcoding the value, use a Gitlab CI
variable "QEMU_TIMEOUT" that can be changed depending on the latest
status of the Gitlab CI runners.

[This backport skips the PPC and RISC scripts as well as the XTF
scripts on x86]

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
master commit: c36efb7fce
master date: 2024-08-09 23:59:20 -0700
2024-08-16 16:03:31 -07:00

46 lines
671 B
Plaintext
Executable File

#!/usr/bin/expect -f
set timeout $env(QEMU_TIMEOUT)
log_file -a $env(QEMU_LOG)
match_max 10000
eval spawn $env(QEMU_CMD)
expect_after {
-re "(.*)\r" {
exp_continue
}
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(LOG_MSG)]} {
expect {
"$env(PASSED)" {
expect "$env(LOG_MSG)"
exit 0
}
"$env(LOG_MSG)" {
expect "$env(PASSED)"
exit 0
}
}
}
expect {
"$env(PASSED)" {
exit 0
}
}
expect eof