From owner-svn-src-head@freebsd.org Tue Sep 3 14:07:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 917E7DD2DF; Tue, 3 Sep 2019 14:07:00 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N8032Jgvz4Q73; Tue, 3 Sep 2019 14:06:59 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id A10331AED8; Tue, 3 Sep 2019 14:06:24 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id A336A12AB4; Wed, 17 Apr 2019 16:27:47 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 38E5087065; Wed, 17 Apr 2019 16:27:47 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 1B7F012AB2; Wed, 17 Apr 2019 16:27:47 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id E39A412AB0 for ; Wed, 17 Apr 2019 16:27:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B26FB87060; Wed, 17 Apr 2019 16:27:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F3EC9A98; Wed, 17 Apr 2019 16:27:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3HGRhQd064939; Wed, 17 Apr 2019 16:27:43 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3HGRhwk064938; Wed, 17 Apr 2019 16:27:43 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201904171627.x3HGRhwk064938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346317 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 346317 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 38E5087065 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US] Status: O X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:07:13 -0000 X-Original-Date: Wed, 17 Apr 2019 16:27:43 +0000 (UTC) X-List-Received-Date: Tue, 03 Sep 2019 14:07:13 -0000 Author: ian Date: Wed Apr 17 16:27:43 2019 New Revision: 346317 URL: https://svnweb.freebsd.org/changeset/base/346317 Log: Allow this test script to be run from within src/tools/boot dir, and create the temporary image in $TMPDIR. Allow the script to be run from the src/tools/boot directory by using make -V SRCTOP to find the top of the tree, because this script is handy for quick smoke-testing of loader changes, as well as being useful in CI testing. Also, use a temp directory in $TMPDIR to assemble the boot image, and write the boot log file to $TMPDIR. Arrange to have the temporary image clean itself up, but leave the log file in $TMPDIR for post-mortem analysis of failures when the script is run interactively. Differential Revision: https://reviews.freebsd.org/D19876 Modified: head/tools/boot/ci-qemu-test.sh Modified: head/tools/boot/ci-qemu-test.sh ============================================================================== --- head/tools/boot/ci-qemu-test.sh Wed Apr 17 16:18:14 2019 (r346316) +++ head/tools/boot/ci-qemu-test.sh Wed Apr 17 16:27:43 2019 (r346317) @@ -2,62 +2,105 @@ # 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. +# virtual FAT filesystem to avoid the need to create a disk image. While +# designed for CI automated testing, this script can also be run by hand as +# a quick smoke-test. The rootgen.sh and related scripts generate much more +# extensive tests for many combinations of boot env (ufs, zfs, geli, etc). # # $FreeBSD$ set -e -# Root directory for minimal FreeBSD installation. -ROOTDIR=$(pwd)/fat-root +die() +{ + echo "$*" 1>&2 + exit 1 +} -# 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 +tempdir_cleanup() +{ + trap - EXIT SIGINT SIGHUP SIGTERM SIGQUIT + rm -rf ${ROOTDIR} +} -# 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 +tempdir_setup() +{ + # Create minimal directory structure and populate it. + # Caller must cd ${SRCTOP} before calling this function. -# Put loader in standard EFI location. -mv $ROOTDIR/boot/loader.efi $ROOTDIR/efi/boot/BOOTx64.EFI + for dir in dev bin efi/boot etc lib libexec sbin usr/lib usr/libexec; do + mkdir -p ${ROOTDIR}/${dir} + done -# Configuration files. -cat > $ROOTDIR/boot/loader.conf < ${ROOTDIR}/boot/loader.conf < $ROOTDIR/etc/rc < ${ROOTDIR}/etc/rc <&1 | tee boot.log -grep -q 'Hello world.' boot.log -echo OK + qemu-system-x86_64 -m 256M -bios ${OVMF} \ + -serial stdio -vga none -nographic -monitor none \ + -snapshot -hda fat:${ROOTDIR} 2>&1 | tee ${BOOTLOG} + +# Check whether we succesfully booted... +if grep -q 'Hello world.' ${BOOTLOG}; then + echo "OK" +else + die "Did not boot successfully, see ${BOOTLOG}" +fi