Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 31 additions & 48 deletions tests/ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ KLDFILEMONISLOADED!=kldload -q -n filemon 2>/dev/null && echo "1" || echo "0"
METAMODE?=-DWITH_META_MODE
.endif

CLEANFILES+= ${.OBJDIR}/${CIIMAGE} ${.OBJDIR}/ci.img ${META_TAR}
PKGBASE_REPO?= ${.OBJDIR}/pkgbase-repo
PKGBASE_REPO_DIR?= ${.OBJDIR}/pkgbase-repo-dir
WSTAGEDIR!= ${IMAKE} -f Makefile.inc1 -C ${WORLDDIR} -V WSTAGEDIR
PKG_ABI_FILE?= ${WSTAGEDIR}/usr/bin/uname
PKG_ABI?= $$(${PKG_CMD} -o ABI_FILE=${PKG_ABI_FILE} config ABI)

CLEANFILES+= ${CIDISK} ${.OBJDIR}/ci.img ${META_TAR}
IMAGEDIR= ${.OBJDIR}/ci-buildimage
CLEANDIRS+= ${IMAGEDIR}

Expand All @@ -151,7 +157,7 @@ portinstall-pkg: .PHONY
.endif

portinstall-qemu: portinstall-pkg .PHONY
.if !exists(/usr/local/bin/qemu-${QEMU_ARCH}-static)
.if !empty(QEMUSTATIC) && !exists(${QEMUSTATIC})
env ASSUME_ALWAYS_YES=yes pkg install emulators/qemu-user-static
.endif
.if !exists(${QEMUBIN})
Expand All @@ -171,66 +177,48 @@ clean: beforeclean .PHONY

cleandir: beforeclean .PHONY

ci-buildworld: .PHONY
@echo "Building world for ${TARGET_ARCH}"
${IMAKE} -j${PARALLEL_JOBS} -C ${WORLDDIR} ${METAMODE} \
${CROSS_TOOLCHAIN_PARAM} __MAKE_CONF=${MAKECONF} SRCCONF=${SRCCONF} \
${EXTRA_MAKE_FLAGS} buildworld ${LOG_TARGET}

ci-buildkernel: ci-buildworld-${TARGET_ARCH:tl} .PHONY
@echo "Building kernel for ${TARGET_ARCH}"
ci-buildpkgbase: .PHONY
@echo "Building world, kernel, and pkgbase for ${TARGET_ARCH}"
${IMAKE} -j${PARALLEL_JOBS} -C ${WORLDDIR} ${METAMODE} \
${CROSS_TOOLCHAIN_PARAM} __MAKE_CONF=${MAKECONF} SRCCONF=${SRCCONF} \
${EXTRA_MAKE_FLAGS} KERNCONF=${KERNCONF} \
buildkernel ${LOG_TARGET}

ci-buildimage: ${QEMUTGT} ci-buildkernel-${TARGET_ARCH:tl} .PHONY
${EXTRA_MAKE_FLAGS} KERNCONF=${KERNCONF} REPODIR=${PKGBASE_REPO} \
buildworld buildkernel update-packages ${LOG_TARGET}
mkdir -p ${PKGBASE_REPO_DIR}
@printf "FreeBSD-base: { url: "file://%s", enabled: yes }" \
${PKGBASE_REPO}/${PKG_ABI}/latest \
> ${PKGBASE_REPO_DIR}/FreeBSD-base.conf

ci-buildimage: ${QEMUTGT} ci-buildpkgbase .PHONY
@echo "Building ci image for ${TARGET_ARCH}"
mkdir -p ${.OBJDIR}/${.TARGET}
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} SWAPSIZE=${SWAPSIZE} \
QEMUSTATIC=${QEMUSTATIC} CITYPE=${CITYPE} \
PKG_CMD=${PKG_CMD:Upkg} \
PKG_ABI=${PKG_ABI} \
PKGBASE_REPO_DIR=${PKGBASE_REPO_DIR} \
${RELEASEDIR}/scripts/mk-vmimage.sh \
-C ${RELEASEDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} -F ${VMFS} \
-i ${.OBJDIR}/ci.img -s ${VMSIZE} -f ${FORMAT} \
-S ${WORLDDIR} -o ${.OBJDIR}/${CIIMAGE} -c ${CICONF} ${LOG_TARGET}
-S ${WORLDDIR} -o ${CIDISK} -c ${CICONF} ${LOG_TARGET}
touch ${.TARGET}

ci-set-smoke-var: .PHONY
CITYPE=smoke

ci-set-full-var: .PHONY
CITYPE=full

ci-create-meta: .PHONY
truncate -s 512M ${META_TAR}
tar rvf ${META_TAR} -C ${META_DIR} .

ci-extract-meta: .PHONY
.if ${CITYPE:tl} == "full"
tar xfv ${META_TAR} -C ${META_DIROUT}
rm -rf ${META_TAR} ${META_DIR}
chmod 0755 ${META_DIROUT}
@echo "Extracted kyua reports to ${META_DIROUT}"

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
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 \
-s 0:0,hostbridge \
-s 1:0,lpc \
-s 2:0,virtio-blk,${CIDISK} \
-s 3:0,virtio-blk,${META_TAR} \
${BHYVE_EXTRA_DISK_PARAM} \
-l com1,stdio \
${TEST_VM_NAME}; \
expect { eof }"
/usr/sbin/bhyvectl --vm=${TEST_VM_NAME} --destroy
.else
rm -rf ${META_TAR} ${META_DIR} ${META_DIROUT}
.endif

ci-runtest: ci-create-meta portinstall .WAIT ci-runtest-${TARGET_ARCH:tl} .WAIT ci-extract-meta .PHONY

ci-runtest-qemu: .PHONY
timeout -k 60 ${TIMEOUT_VM} ${QEMUBIN} \
-machine ${QEMU_MACHINE} \
-smp ${QEMU_CPU_COUNT} \
Expand All @@ -243,7 +231,6 @@ ci-runtest: ci-buildimage-${TARGET_ARCH:tl} portinstall .PHONY
-blockdev driver=raw,node-name=hd0,file.driver=file,file.filename=${CIDISK} \
-blockdev driver=raw,node-name=hd1,file.driver=file,file.filename=${META_TAR} \
${QEMU_DEVICES}
.endif

ci-checktarget: .PHONY
.if ${TARGET_ARCH} != "aarch64" && \
Expand All @@ -257,10 +244,6 @@ ci-checktarget: .PHONY
@echo "Error: ${TARGET_ARCH} is not supported on ${TYPE} ${REVISION} ${BRANCH}"
.endif

ci-smoke: ci-set-smoke-var ci-create-meta ci-checktarget .WAIT ci-runtest-${TARGET_ARCH:tl} .PHONY

ci-full: ci-set-full-var ci-create-meta ci-checktarget .WAIT ci-runtest-${TARGET_ARCH:tl} .WAIT ci-extract-meta .PHONY

ci: ci-${CITYPE:tl} .PHONY
ci: ci-buildimage-${TARGET_ARCH:tl} .WAIT ci-runtest .PHONY

.include "${RELEASEDIR}/Makefile.inc1"
36 changes: 27 additions & 9 deletions tests/ci/Makefile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,35 @@ QEMU_EXTRA_PARAM=-bios /usr/local/share/u-boot/u-boot-qemu-arm64/u-boot.bin -cpu
QEMU_MAX_CPU_COUNT=64
QEMU_MAX_MEM_SIZE=64

portinstall-aarch64: portinstall-pkg .PHONY
.if !exists(/usr/local/share/u-boot/u-boot-qemu-arm64/u-boot.bin)
env ASSUME_ALWAYS_YES=yes pkg install sysutils/u-boot-qemu-arm64
.endif

# NOTE: Nothing should be changed below this line unless explicitly required.

ci-buildworld-aarch64: ci-buildworld .PHONY
ci-buildimage-aarch64: ci-buildimage .PHONY

ci-buildkernel-aarch64: ci-buildkernel .PHONY
.if ${MACHINE} == "arm64" && ( !defined(USE_QEMU) || empty(USE_QEMU) )
portinstall-aarch64: portinstall-pkg .PHONY
.if !exists(/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin)
env ASSUME_ALWAYS_YES=yes pkg install sysutils/u-boot-bhyve-arm64
.endif

ci-buildimage-aarch64: ci-buildimage .PHONY
ci-runtest-aarch64: .PHONY
/usr/sbin/bhyvectl --vm=${TEST_VM_NAME} --destroy || true
expect -c "set timeout ${TIMEOUT_EXPECT}; \
spawn /usr/bin/timeout -k 60 ${TIMEOUT_VM} /usr/sbin/bhyve \
-c ${PARALLEL_JOBS} -m ${VM_MEM_SIZE} \
-s 0:0,hostbridge \
-s 2:0,virtio-blk,${CIDISK} \
-s 3:0,virtio-blk,${META_TAR} \
${BHYVE_EXTRA_DISK_PARAM} \
-o console=stdio \
-o bootrom=/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin \
${TEST_VM_NAME}; \
expect { eof }"
/usr/sbin/bhyvectl --vm=${TEST_VM_NAME} --destroy
.else
portinstall-aarch64: portinstall-pkg .PHONY
.if !exists(/usr/local/share/u-boot/u-boot-qemu-arm64/u-boot.bin)
env ASSUME_ALWAYS_YES=yes pkg install sysutils/u-boot-qemu-arm64
.endif

ci-runtest-aarch64: ci-runtest .PHONY
ci-runtest-aarch64: ci-runtest-qemu .PHONY
.endif
28 changes: 23 additions & 5 deletions tests/ci/Makefile.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,28 @@ portinstall-amd64: portinstall-pkg .PHONY

# NOTE: Nothing should be changed below this line unless explicitly required.

ci-buildworld-amd64: ci-buildworld .PHONY

ci-buildkernel-amd64: ci-buildkernel .PHONY

ci-buildimage-amd64: ci-buildimage .PHONY

ci-runtest-amd64: ci-runtest .PHONY
.if ${MACHINE} == "amd64" && ( !defined(USE_QEMU) || empty(USE_QEMU) )
ci-runtest-amd64: .PHONY
/usr/sbin/bhyvectl --vm=${TEST_VM_NAME} --destroy || true
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 \
-s 0:0,hostbridge \
-s 1:0,lpc \
-s 2:0,virtio-blk,${CIDISK} \
-s 3:0,virtio-blk,${META_TAR} \
${BHYVE_EXTRA_DISK_PARAM} \
-l com1,stdio \
${TEST_VM_NAME}; \
expect { eof }"
/usr/sbin/bhyvectl --vm=${TEST_VM_NAME} --destroy
.else
ci-runtest-amd64: ci-runtest-qemu .PHONY
.endif
6 changes: 1 addition & 5 deletions tests/ci/Makefile.armv7
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ portinstall-armv7: portinstall-pkg .PHONY

# NOTE: Nothing should be changed below this line unless explicitly required.

ci-buildworld-armv7: ci-buildworld .PHONY

ci-buildkernel-armv7: ci-buildkernel .PHONY

ci-buildimage-armv7: ci-buildimage .PHONY

ci-runtest-armv7: ci-runtest .PHONY
ci-runtest-armv7: ci-runtest-qemu .PHONY
6 changes: 1 addition & 5 deletions tests/ci/Makefile.powerpc64
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ portinstall-powerpc64: portinstall-pkg .PHONY

# NOTE: Nothing should be changed below this line unless explicitly required.

ci-buildworld-powerpc64: ci-buildworld .PHONY

ci-buildkernel-powerpc64: ci-buildkernel .PHONY

ci-buildimage-powerpc64: ci-buildimage .PHONY

ci-runtest-powerpc64: ci-runtest .PHONY
ci-runtest-powerpc64: ci-runtest-qemu .PHONY
6 changes: 1 addition & 5 deletions tests/ci/Makefile.powerpc64le
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ portinstall-powerpc64le: portinstall-pkg .PHONY

# NOTE: Nothing should be changed below this line unless explicitly required.

ci-buildworld-powerpc64le: ci-buildworld .PHONY

ci-buildkernel-powerpc64le: ci-buildkernel .PHONY

ci-buildimage-powerpc64le: ci-buildimage .PHONY

ci-runtest-powerpc64le: ci-runtest .PHONY
ci-runtest-powerpc64le: ci-runtest-qemu .PHONY
6 changes: 1 addition & 5 deletions tests/ci/Makefile.riscv64
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ portinstall-riscv64: portinstall-pkg .PHONY

# NOTE: Nothing should be changed below this line unless explicitly required.

ci-buildworld-riscv64: ci-buildworld .PHONY

ci-buildkernel-riscv64: ci-buildkernel .PHONY

ci-buildimage-riscv64: ci-buildimage .PHONY

ci-runtest-riscv64: ci-runtest .PHONY
ci-runtest-riscv64: ci-runtest-qemu .PHONY
Loading