diff options
| author | Siva Mahadevan <me@svmhdvn.name> | 2025-07-07 17:16:13 +0000 |
|---|---|---|
| committer | Li-Wen Hsu <lwhsu@FreeBSD.org> | 2025-07-08 11:32:17 +0000 |
| commit | 2f50ea54c6e3b15f655e800eb680ddcb80e30b4f (patch) | |
| tree | edddff05ef967da0582501e9ea4ccf863312369f | |
| parent | 45730dd3ed334d265fc77cf6df1f82013fd5bf69 (diff) | |
tests/ci: fix race condition in bhyveload boot
Currently, there is a race condition where the
Makefile sh invocation of 'bhyveload -c stdio'
exits before receiving any user input in the bootloader
(e.g. in the form of a user typically pressing <enter>),
causing the 'expect' script to wrongly spawn the 'bhyve'
invocation while still in the bootloader.
This patch wraps bhyveload in expect(1) to ensure that
stdio is correctly consumed before the process exits.
Signed-off-by: Siva Mahadevan <me@svmhdvn.name>
Sponsored by: The FreeBSD Foundation
Pull Request: https://github.com/freebsd/freebsd-src/pull/1757
| -rw-r--r-- | tests/ci/Makefile | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/ci/Makefile b/tests/ci/Makefile index 271fc377619b..44b19663fc49 100644 --- a/tests/ci/Makefile +++ b/tests/ci/Makefile @@ -210,7 +210,11 @@ ci-extract-meta: .PHONY ci-runtest: ci-buildimage-${TARGET_ARCH:tl} portinstall .PHONY .if ${MACHINE} == "amd64" && ( ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" ) && ( !defined(USE_QEMU) || empty(USE_QEMU) ) /usr/sbin/bhyvectl --vm=${TEST_VM_NAME} --destroy || true - /usr/sbin/bhyveload -c stdio -m ${VM_MEM_SIZE} -d ${CIDISK} ${TEST_VM_NAME} + expect -c "set timeout ${TIMEOUT_EXPECT}; \ + spawn /usr/bin/timeout -k 5s 30s /usr/sbin/bhyveload \ + -c stdio -m ${VM_MEM_SIZE} -d ${CIDISK} ${TEST_VM_NAME}; \ + expect { eof }; \ + exit [lindex [wait] 3]" expect -c "set timeout ${TIMEOUT_EXPECT}; \ spawn /usr/bin/timeout -k 60 ${TIMEOUT_VM} /usr/sbin/bhyve \ -c ${PARALLEL_JOBS} -m ${VM_MEM_SIZE} -A -H -P \ |
