Skip to content

Commit

Permalink
Add an integration test for Alpine Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
anatol committed Nov 13, 2021
1 parent 342a894 commit 1891e1f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/generate_asset_alpinelinux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
trap 'quit' EXIT ERR

quit() {
set +o errexit
sudo umount $mount
rm -rf $mount
sudo losetup -d $lodev
}

truncate --size 200M $OUTPUT
mkfs.ext4 $OUTPUT
lodev=$(sudo losetup -f --show $OUTPUT)
mount=$(mktemp -d)
sudo mount $lodev $mount

sudo mkdir -p $mount/etc/apk/
echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" | sudo tee -a $mount/etc/apk/repositories
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" | sudo tee -a $mount/etc/apk/repositories
sudo apk --root $mount --initdb --update-cache --allow-untrusted add alpine-base util-linux-misc

sudo chroot $mount /bin/sh -eu <<EOT
cd /etc/init.d
/bin/ln -s agetty agetty.ttyS0
/sbin/rc-update add agetty.ttyS0 default
EOT
10 changes: 10 additions & 0 deletions tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ func initAssetsGenerators() error {
assetGenerators["assets/archlinux.ext4.raw"] = assetGenerator{"generate_asset_archlinux_ext4.sh", []string{"OUTPUT=assets/archlinux.ext4.raw"}}
assetGenerators["assets/archlinux.btrfs.raw"] = assetGenerator{"generate_asset_archlinux_btrfs.sh", []string{"OUTPUT=assets/archlinux.btrfs.raw", "LUKS_PASSWORD=hello"}}
assetGenerators["assets/voidlinux.img"] = assetGenerator{"generate_asset_voidlinux.sh", []string{"OUTPUT=assets/voidlinux.img"}}
assetGenerators["assets/alpinelinux.img"] = assetGenerator{"generate_asset_alpinelinux.sh", []string{"OUTPUT=assets/alpinelinux.img"}}
assetGenerators["assets/systemd-fido2.img"] = assetGenerator{"generate_asset_systemd_fido2.sh", []string{"OUTPUT=assets/systemd-fido2.img", "LUKS_UUID=b12cbfef-da87-429f-ac96-7dda7232c189", "FS_UUID=bb351f0d-07f2-4fe4-bc53-d6ae39fa1c23", "LUKS_PASSWORD=567", "FIDO2_PIN=1111"}} // use yubikey-manager-qt (or fido2-token -C) to setup FIDO2 pin value to 1111
assetGenerators["assets/systemd-tpm2.img"] = assetGenerator{"generate_asset_systemd_tpm2.sh", []string{"OUTPUT=assets/systemd-tpm2.img", "LUKS_UUID=5cbc48ce-0e78-4c6b-ac90-a8a540514b90", "FS_UUID=d8673e36-d4a3-4408-a87d-be0cb79f91a2", "LUKS_PASSWORD=567"}}

Expand Down Expand Up @@ -915,6 +916,15 @@ func TestBooster(t *testing.T) {
},
}))

t.Run("AlpineLinux", boosterTest(Opts{
disk: "assets/alpinelinux.img",
kernelArgs: []string{"root=/dev/sda"},
forceKill: true,
checkVMState: func(vm *vmtest.Qemu, t *testing.T) {
require.NoError(t, vm.ConsoleExpect("Welcome to Alpine Linux"))
},
}))

// boot Arch userspace (with systemd) against all installed linux packages
for pkg, ver := range kernelVersions {
compression := "zstd"
Expand Down

0 comments on commit 1891e1f

Please sign in to comment.