github: Resize image to 8 GB before running test

This commit is contained in:
Johan Gunnarsson 2022-12-26 19:43:25 +01:00
parent 5279cdcc51
commit ff4451f6b6
3 changed files with 34 additions and 5 deletions

View File

@ -106,6 +106,7 @@ jobs:
debian-archive-keyring \ debian-archive-keyring \
debootstrap \ debootstrap \
e2fsprogs \ e2fsprogs \
parted \
pigz \ pigz \
pwgen \ pwgen \
qemu-system-x86 \ qemu-system-x86 \

View File

@ -56,7 +56,8 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get --assume-yes \ sudo apt-get --assume-yes \
--no-install-recommends \ --no-install-recommends \
install pigz \ install parted \
pigz \
qemu-system-x86 \ qemu-system-x86 \
qemu-system-arm \ qemu-system-arm \
ssh \ ssh \

View File

@ -20,8 +20,11 @@ echo "Using password ${SSHPASS}"
# Build image # Build image
zcat "${BOOT}" "${DEBIAN}" > image.bin zcat "${BOOT}" "${DEBIAN}" > image.bin
# Assume 4GB virtual disk # Assume 8GB virtual disk
fallocate -l 4GB image.bin fallocate -l 8GB image.bin
# Extend second partition
parted -s -a opt image.bin "resizepart 2 100%"
# Extract U-Boot (u-boot.rom in x86 case) # Extract U-Boot (u-boot.rom in x86 case)
dd if=image.bin of=bios.bin count=2048 skip=16 dd if=image.bin of=bios.bin count=2048 skip=16
@ -78,15 +81,39 @@ sleep 15
# Pass password to sshpass # Pass password to sshpass
export SSHPASS export SSHPASS
# SSH into QEMU and shut it down # Wait for start up
until sshpass -e ssh -o "ConnectTimeout=5" \ until sshpass -e ssh -o "ConnectTimeout=5" \
-o "StrictHostKeyChecking=no" \ -o "StrictHostKeyChecking=no" \
-o "UserKnownHostsFile=/dev/null" \ -o "UserKnownHostsFile=/dev/null" \
-p 5555 \ -p 5555 \
-q \ -q \
root@localhost "sleep 5 && apt-get update && poweroff"; do root@localhost /bin/true; do
sleep 1 sleep 1
done done
sleep 5
# Run test
sshpass -e ssh -o "ConnectTimeout=5" \
-o "StrictHostKeyChecking=no" \
-o "UserKnownHostsFile=/dev/null" \
-p 5555 \
-q \
root@localhost <<END
# Abort on error
set -ex
# Resize root filesystem
resize2fs /dev/sda2
# Install updates
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get upgrade -y
# Shut down
poweroff
END
# Wait for QEMU to exit # Wait for QEMU to exit
wait wait