Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/build-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ jobs:
- name: Run convert test
run: |
docker exec -w /workspace/repo test-container bash -c "
make run-convert-test-case BOOTLOADER=${{ matrix.bootloader }} ROOTFS_ENC=${{ matrix.rootfs_enc }} DELTA_LOCATION=${{ matrix.delta_location }} INPUT_IMAGE=/workspace/test-images/test-image.qcow2 CRYPTPILOT_FDE_RPM=${{ steps.install-rpm.outputs.cryptpilot_fde_rpm_container }}
make run-convert-test-case BOOTLOADER=${{ matrix.bootloader }} ROOTFS_ENC=${{ matrix.rootfs_enc }} DELTA_LOCATION=${{ matrix.delta_location }} INPUT_IMAGE=/workspace/test-images/test-image.qcow2 CRYPTPILOT_FDE_RPM=${{ steps.install-rpm.outputs.cryptpilot_fde_rpm_container }} QEMU_RAM=4G
"

- name: Print convert diagnostic log
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ install-convert-test-depend:

.PHONY: run-convert-test-case
run-convert-test-case: install-convert-test-depend
bash tests/test-convert.sh --rpm $(CRYPTPILOT_FDE_RPM) --bootloader $(BOOTLOADER) --rootfs-$(ROOTFS_ENC) --delta-location $(DELTA_LOCATION) $(if $(INPUT_IMAGE),--input $(INPUT_IMAGE),)
bash tests/test-convert.sh --rpm $(CRYPTPILOT_FDE_RPM) --bootloader $(BOOTLOADER) --rootfs-$(ROOTFS_ENC) --delta-location $(DELTA_LOCATION) $(if $(INPUT_IMAGE),--input $(INPUT_IMAGE),) $(if $(QEMU_RAM),--ram $(QEMU_RAM),)

.PHONE: shellcheck
shellcheck:
Expand Down
19 changes: 17 additions & 2 deletions tests/test-convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# --rootfs-enc (flag) rootfs encryption enabled
# --rootfs-noenc (flag) rootfs encryption disabled
# --delta-location ram | disk | disk-persist
# --ram <size> Pin QEMU guest RAM (e.g. 4G, 4096M). Defaults to
# 80% of host MemTotal. Also set via QEMU_RAM_SIZE.
#
# Usage:
# ./tests/test-convert.sh --rpm <path> --bootloader <uki|grub> --rootfs-enc|--rootfs-noenc --delta-location <ram|disk|disk-persist>
Expand Down Expand Up @@ -562,7 +564,14 @@ test_qemu_boot() {

local boot_log="${WORKDIR}/${test_name}-boot.log"

log::info "Starting QEMU container with UEFI boot mode"
# Pin guest RAM when --ram / QEMU_RAM_SIZE is given; otherwise fall back to
# 80% of host MemTotal (read from /proc/meminfo of this privileged runtime
# container, which reflects the CI runner's physical memory). Pinning a
# low value (e.g. 4G) is what surfaces the UKI "SizeOfImage hole" class of
# regressions, since UEFI LoadImage() must allocate SizeOfImage bytes of
# contiguous memory up front.
local ram_size="${QEMU_RAM_SIZE:-$(awk '/MemTotal/{printf "%d", $2 * 0.8 / 1024}' /proc/meminfo)}"
log::info "Starting QEMU container with UEFI boot mode (RAM_SIZE=${ram_size})"

# Start QEMU container in background
local container_name="qemu-test-${test_name}-$$"
Expand All @@ -582,7 +591,7 @@ test_qemu_boot() {
-e BOOT="" \
-e "KVM=N" \
-e "CPU_CORES=$(nproc)" \
-e "RAM_SIZE=$(awk '/MemTotal/{printf "%d", $2 * 0.8 / 1024}' /proc/meminfo)" \
-e "RAM_SIZE=${ram_size}" \
--entrypoint /bin/bash \
--name "${container_name}" \
ghcr.io/qemus/qemu:7.29 \
Expand Down Expand Up @@ -751,6 +760,8 @@ Required:

Options:
--input <path> Use specified qcow2 image instead of downloading
--ram <size> Pin QEMU guest RAM (e.g. 4G, 4096M). Defaults to 80% of
host MemTotal when not given. Overridable via QEMU_RAM_SIZE.
--help Show this help message

Examples:
Expand Down Expand Up @@ -792,6 +803,10 @@ main() {
custom_input="$2"
shift 2
;;
--ram)
QEMU_RAM_SIZE="$2"
shift 2
;;
--help|-h)
show_help
exit 0
Expand Down
Loading