From 4587740df13cc651015a97f9fea037ac04e67f74 Mon Sep 17 00:00:00 2001 From: Mikkel Georgsen Date: Sun, 25 Jan 2026 20:44:09 +0000 Subject: [PATCH] test(01-05): add minimal ISO build test profile and script - Minimal archiso profile (base + linux only) - Test script runs build in container sandbox - Verifies end-to-end ISO generation pipeline Usage: ./scripts/test-iso-build.sh Co-Authored-By: Claude Opus 4.5 --- scripts/test-iso-build.sh | 75 +++++++++++++++++++ .../archiso-test-profile/packages.x86_64 | 3 + .../fixtures/archiso-test-profile/pacman.conf | 11 +++ .../archiso-test-profile/profiledef.sh | 15 ++++ 4 files changed, 104 insertions(+) create mode 100755 scripts/test-iso-build.sh create mode 100644 tests/fixtures/archiso-test-profile/packages.x86_64 create mode 100644 tests/fixtures/archiso-test-profile/pacman.conf create mode 100644 tests/fixtures/archiso-test-profile/profiledef.sh diff --git a/scripts/test-iso-build.sh b/scripts/test-iso-build.sh new file mode 100755 index 0000000..6767ae3 --- /dev/null +++ b/scripts/test-iso-build.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# Test ISO build using the container sandbox +# Creates a minimal Arch ISO to verify the build pipeline works + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" + +# Configuration +PROFILE_DIR="$PROJECT_ROOT/tests/fixtures/archiso-test-profile" +OUTPUT_DIR="$PROJECT_ROOT/tmp/iso-test-output" +BUILD_IMAGE="debate-archiso-builder:latest" + +log() { + echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" +} + +# Detect container runtime +if command -v podman &> /dev/null; then + RUNTIME="podman" +elif command -v docker &> /dev/null; then + RUNTIME="docker" +else + log "ERROR: No container runtime found. Install podman or docker." + exit 1 +fi + +log "Using runtime: $RUNTIME" + +# Check if build image exists +if ! $RUNTIME image inspect "$BUILD_IMAGE" &> /dev/null; then + log "Build image not found. Run: ./scripts/setup-sandbox.sh" + exit 1 +fi + +# Create output directory +mkdir -p "$OUTPUT_DIR" +log "Output directory: $OUTPUT_DIR" + +# Run the build +log "Starting ISO build (this may take several minutes)..." +log "Profile: $PROFILE_DIR" + +$RUNTIME run \ + --name debate-test-build \ + --rm \ + --network=none \ + --privileged \ + --tmpfs=/tmp:exec,mode=1777 \ + --tmpfs=/var/tmp:exec,mode=1777 \ + -v "$PROFILE_DIR:/build/profile:ro" \ + -v "$OUTPUT_DIR:/build/output:rw" \ + -e SOURCE_DATE_EPOCH=1704067200 \ + -e LC_ALL=C \ + -e TZ=UTC \ + "$BUILD_IMAGE" \ + mkarchiso -v -w /tmp/archiso-work -o /build/output /build/profile + +# Check result +if ls "$OUTPUT_DIR"/*.iso &> /dev/null; then + ISO_FILE=$(ls "$OUTPUT_DIR"/*.iso | head -1) + ISO_SIZE=$(du -h "$ISO_FILE" | cut -f1) + log "SUCCESS! ISO created: $ISO_FILE ($ISO_SIZE)" + log "" + log "To verify the ISO:" + log " sha256sum $ISO_FILE" + log "" + log "To test in a VM:" + log " qemu-system-x86_64 -cdrom $ISO_FILE -m 2G -enable-kvm" +else + log "ERROR: No ISO file found in output directory" + log "Check the build output above for errors" + exit 1 +fi diff --git a/tests/fixtures/archiso-test-profile/packages.x86_64 b/tests/fixtures/archiso-test-profile/packages.x86_64 new file mode 100644 index 0000000..aa83087 --- /dev/null +++ b/tests/fixtures/archiso-test-profile/packages.x86_64 @@ -0,0 +1,3 @@ +base +linux +mkinitcpio diff --git a/tests/fixtures/archiso-test-profile/pacman.conf b/tests/fixtures/archiso-test-profile/pacman.conf new file mode 100644 index 0000000..8cdff8c --- /dev/null +++ b/tests/fixtures/archiso-test-profile/pacman.conf @@ -0,0 +1,11 @@ +[options] +Architecture = auto +CheckSpace +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional + +[core] +Include = /etc/pacman.d/mirrorlist + +[extra] +Include = /etc/pacman.d/mirrorlist diff --git a/tests/fixtures/archiso-test-profile/profiledef.sh b/tests/fixtures/archiso-test-profile/profiledef.sh new file mode 100644 index 0000000..cc4e40c --- /dev/null +++ b/tests/fixtures/archiso-test-profile/profiledef.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Minimal test profile for Debate ISO builds + +iso_name="debate-test" +iso_label="DEBATE_TEST" +iso_publisher="Debate Platform " +iso_application="Debate Test ISO" +iso_version="test" +install_dir="arch" +buildmodes=('iso') +bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito') +arch="x86_64" +pacman_conf="pacman.conf" +airootfs_image_type="squashfs" +airootfs_image_tool_options=('-comp' 'xz' '-b' '1M')