diff --git a/.cirrus.yml b/.cirrus.yml index 8c9ee1f6745b..f58681973d7a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,35 +1,35 @@ # $FreeBSD$ compute_engine_instance: # Image list available via # gcloud compute images list --project freebsd-org-cloud-dev --no-standard-images platform: freebsd image_project: freebsd-org-cloud-dev image: freebsd-13-0-release-amd64 cpu: 8 memory: 8G disk: 40 env: CIRRUS_CLONE_DEPTH: 1 task: name: World and kernel amd64 build and boot smoke test timeout_in: 120m install_script: - - sh .cirrus-ci/pkg-install.sh qemu uefi-edk2-qemu-x86_64 llvm11 + - sh .cirrus-ci/pkg-install.sh qemu llvm11 setup_script: - uname -a - df -m - pw useradd user - mkdir -p /usr/obj/$(pwd -P) - chown user:user /usr/obj/$(pwd -P) script: - su user -c "make -j$(sysctl -n hw.ncpu) CROSS_TOOLCHAIN=llvm11 WITHOUT_TOOLCHAIN=yes buildworld buildkernel" package_script: - su user -c "make CROSS_TOOLCHAIN=llvm11 WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages" test_script: - sh tools/boot/ci-qemu-test.sh post_script: - df -m - du -m -s /usr/obj \ No newline at end of file diff --git a/tools/boot/ci-qemu-test.sh b/tools/boot/ci-qemu-test.sh index c68531550dbc..acd905b7ece8 100755 --- a/tools/boot/ci-qemu-test.sh +++ b/tools/boot/ci-qemu-test.sh @@ -1,107 +1,106 @@ #!/bin/sh # Install pkgbase packages for 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. # While designed for CI automated testing, this script can also be run by hand # as a quick smoke-test as long as pkgbase packages have been built. The # rootgen.sh and related scripts generate much more extensive tests for many # combinations of boot env (ufs, zfs, geli, etc). # # $FreeBSD$ set -e die() { echo "$*" 1>&2 exit 1 } tempdir_cleanup() { trap - EXIT SIGINT SIGHUP SIGTERM SIGQUIT rm -rf ${ROOTDIR} } tempdir_setup() { # Create minimal directory structure and populate it. for dir in dev bin efi/boot etc lib libexec sbin usr/lib usr/libexec; do mkdir -p ${ROOTDIR}/${dir} done # Install kernel, loader and minimal userland. cat<${ROOTDIR}/pkg.conf REPOS_DIR=[] repositories={local {url = file://$(dirname $OBJTOP)/repo/\${ABI}/latest}} EOF ASSUME_ALWAYS_YES=true INSTALL_AS_USER=true pkg \ -o ABI_FILE=$OBJTOP/bin/sh/sh \ -C ${ROOTDIR}/pkg.conf -r ${ROOTDIR} install \ FreeBSD-kernel-generic FreeBSD-bootloader \ FreeBSD-clibs FreeBSD-runtime # 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 <&2 die "Cannot read UEFI firmware file ${OVMF}" fi # Create a temp dir to hold the boot image. ROOTDIR=$(mktemp -d -t ci-qemu-test-fat-root) trap tempdir_cleanup EXIT SIGINT SIGHUP SIGTERM SIGQUIT # Populate the boot image in a temp dir. ( cd ${SRCTOP} && tempdir_setup ) # And, boot in QEMU. : ${BOOTLOG:=${TMPDIR:-/tmp}/ci-qemu-test-boot.log} timeout 300 \ qemu-system-x86_64 -m 256M -nodefaults \ -drive if=pflash,format=raw,readonly,file=${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