mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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. Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
46 lines
671 B
Plaintext
Executable File
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
|
|
|