github: Resize image to 8 GB before running test
This commit is contained in:
parent
5279cdcc51
commit
ff4451f6b6
|
|
@ -106,6 +106,7 @@ jobs:
|
|||
debian-archive-keyring \
|
||||
debootstrap \
|
||||
e2fsprogs \
|
||||
parted \
|
||||
pigz \
|
||||
pwgen \
|
||||
qemu-system-x86 \
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ jobs:
|
|||
sudo apt-get update
|
||||
sudo apt-get --assume-yes \
|
||||
--no-install-recommends \
|
||||
install pigz \
|
||||
install parted \
|
||||
pigz \
|
||||
qemu-system-x86 \
|
||||
qemu-system-arm \
|
||||
ssh \
|
||||
|
|
|
|||
35
test/qemu.sh
35
test/qemu.sh
|
|
@ -20,8 +20,11 @@ echo "Using password ${SSHPASS}"
|
|||
# Build image
|
||||
zcat "${BOOT}" "${DEBIAN}" > image.bin
|
||||
|
||||
# Assume 4GB virtual disk
|
||||
fallocate -l 4GB image.bin
|
||||
# Assume 8GB virtual disk
|
||||
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)
|
||||
dd if=image.bin of=bios.bin count=2048 skip=16
|
||||
|
|
@ -78,15 +81,39 @@ sleep 15
|
|||
# Pass password to sshpass
|
||||
export SSHPASS
|
||||
|
||||
# SSH into QEMU and shut it down
|
||||
# Wait for start up
|
||||
until sshpass -e ssh -o "ConnectTimeout=5" \
|
||||
-o "StrictHostKeyChecking=no" \
|
||||
-o "UserKnownHostsFile=/dev/null" \
|
||||
-p 5555 \
|
||||
-q \
|
||||
root@localhost "sleep 5 && apt-get update && poweroff"; do
|
||||
root@localhost /bin/true; do
|
||||
sleep 1
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue