Files

38 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Webinterface-Endpunkt-Test: QEMU im Hintergrund, dann HTTP(S) aus dem Container testen.
set -uo pipefail
WORK="${WORK:-/build/work}"
LOGS="${LOGS:-/build/logs}"
WAIT="${WEB_WAIT:-240}"
qemu-system-aarch64 -M virt -cpu cortex-a53 -m 1024 -smp 1 \
-kernel "$WORK/deb-kernel/boot/vmlinuz-6.1.0-50-arm64" \
-initrd "$WORK/initramfs.img" \
-drive if=virtio,format=raw,file="$WORK/rootfs.ext4" \
-netdev user,id=n0,hostfwd=tcp::8080-:80,hostfwd=tcp::8443-:443 \
-device virtio-net-pci,netdev=n0 \
-no-reboot -nographic \
-append "root=/dev/vda rw console=ttyAMA0,115200" \
> "$LOGS/boot-webtest.log" 2>&1 &
QPID=$!
trap 'kill $QPID 2>/dev/null' EXIT
echo "QEMU (PID $QPID), warte ${WAIT}s auf Boot + GUI-Start..."
sleep "$WAIT"
echo "=== Port-Tests ==="
if wget -q -O /tmp/idx80.html --timeout=8 http://127.0.0.1:8080/; then
echo "HTTP 8080: OK, $(wc -c < /tmp/idx80.html) bytes"
head -3 /tmp/idx80.html
else
echo "HTTP 8080: FEHLER"
fi
if wget -q -O /tmp/idx443.html --no-check-certificate --timeout=8 https://127.0.0.1:8443/; then
echo "HTTPS 8443: OK, $(wc -c < /tmp/idx443.html) bytes"
head -3 /tmp/idx443.html
else
echo "HTTPS 8443: FEHLER"
fi
echo "=== GUI-/Netz-Zeilen aus Bootlog ==="
grep -aiE 'bevyosgui|eth0|br0|qemu-net' "$LOGS/boot-webtest.log" | tail -12