From cc2e55c7ea40b559cae05155a7af384b2c48d278 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 10 Apr 2019 13:41:34 +0000 Subject: [PATCH] Add a smoke test QEMU boot script for CI Reviewed by: imp, lwhsu (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19661 --- tools/boot/ci-qemu-test.sh | 63 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 tools/boot/ci-qemu-test.sh diff --git a/tools/boot/ci-qemu-test.sh b/tools/boot/ci-qemu-test.sh new file mode 100755 index 000000000000..ec7a0aa849bb --- /dev/null +++ b/tools/boot/ci-qemu-test.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +# Install loader, kernel, and enough of userland to boot in QEMU and echo +# "Hello world." from init, as a very quick smoke test for CI. Uses QEMU's +# virtual FAT filesystem to avoid the need to create a disk image. +# +# $FreeBSD$ + +set -e + +# Root directory for minimal FreeBSD installation. +ROOTDIR=$(pwd)/fat-root + +# Create minimal directory structure. +rm -f $ROOTDIR/efi/boot/BOOTx64.EFI +for dir in dev bin efi/boot etc lib libexec sbin usr/libexec; do + mkdir -p $ROOTDIR/$dir +done + +# Install kernel, loader and minimal userland. +make -DNO_ROOT DESTDIR=$ROOTDIR \ + MODULES_OVERRIDE= \ + WITHOUT_DEBUG_FILES=yes \ + WITHOUT_KERNEL_SYMBOLS=yes \ + installkernel +for dir in stand \ + lib/libc lib/libedit lib/ncurses \ + libexec/rtld-elf \ + bin/sh sbin/init sbin/shutdown; do + make -DNO_ROOT DESTDIR=$ROOTDIR INSTALL="install -U" \ + WITHOUT_MAN= \ + WITHOUT_PROFILE= \ + WITHOUT_TESTS= \ + WITHOUT_TOOLCHAIN= \ + -C $dir install +done + +# Put loader in standard EFI location. +mv $ROOTDIR/boot/loader.efi $ROOTDIR/efi/boot/BOOTx64.EFI + +# Configuration files. +cat > $ROOTDIR/boot/loader.conf < $ROOTDIR/etc/rc <&1 | tee boot.log +grep -q 'Hello world.' boot.log +echo OK