Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jul 2025 11:38:37 GMT
From:      Li-Wen Hsu <lwhsu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2f50ea54c6e3 - main - tests/ci: fix race condition in bhyveload boot
Message-ID:  <202507081138.568BcbgG036618@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by lwhsu:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f50ea54c6e3b15f655e800eb680ddcb80e30b4f

commit 2f50ea54c6e3b15f655e800eb680ddcb80e30b4f
Author:     Siva Mahadevan <me@svmhdvn.name>
AuthorDate: 2025-07-07 17:16:13 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2025-07-08 11:32:17 +0000

    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
---
 tests/ci/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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 \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202507081138.568BcbgG036618>