diff options
author | Helmut Grohne <helmut@subdivi.de> | 2025-04-06 10:08:34 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2025-04-06 17:44:08 +0200 |
commit | 5f22a836f2c3330d9f2c3707167096e1e3ece31f (patch) | |
tree | de96588d0b93f9f9106d1881001ff049ba05496c | |
parent | 6f2a356ca10ab97ed257097996593d707eca9bd7 (diff) | |
download | debvm-5f22a836f2c3330d9f2c3707167096e1e3ece31f.tar.gz |
salsa-ci: add basic tests for debefivm-*
-rw-r--r-- | .gitlab-ci.yml | 31 | ||||
-rwxr-xr-x | tests/create-and-run.sh | 2 | ||||
-rwxr-xr-x | tests/efi-create-and-run.sh | 46 | ||||
-rwxr-xr-x | tests/shell_interaction.expect | 2 |
4 files changed, 79 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 09e8a5f..97fc9a0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,6 +35,22 @@ release_test: - apt-get --no-install-recommends --yes install curl e2fsprogs expect gpgv mmdebstrap openssh-client qemu-kvm dpkg-dev - PATH=$(pwd)/bin:$PATH ./tests/create-and-run.sh $(dpkg --print-architecture) "$RELEASE" +release_test_efi: + parallel: + matrix: + - RELEASE: + - sid + - trixie + - bookworm + UKIFY: + - systemd-ukify + - binutils-multiarch + script: + - apt-get update + - apt-get dist-upgrade --yes + - apt-get --no-install-recommends --yes install dosfstools dpkg-dev e2fsprogs expect fdisk mmdebstrap mount mtools openssh-client ovmf qemu-kvm systemd $UKIFY + - PATH=$(pwd)/bin:$PATH ./tests/efi-create-and-run.sh $(dpkg --print-architecture) "$RELEASE" + debci_test: script: - apt-get update @@ -61,3 +77,18 @@ arch_test: - apt-get --no-install-recommends --yes install curl e2fsprogs expect mmdebstrap openssh-client qemu-system arch-test qemu-user-static file systemd dpkg-dev debian-ports-archive-keyring - /lib/systemd/systemd-binfmt - PATH=$(pwd)/bin:$PATH ./tests/create-and-run.sh "$ARCHITECTURE" "$DEFAULT_SUITE" + +arch_test_efi: + parallel: + matrix: + - ARCHITECTURE: + - arm64 + - armhf + - riscv64 + script: + - test -e /proc/sys/fs/binfmt_misc/status || mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc + - apt-get update + - apt-get dist-upgrade --yes + - apt-get --no-install-recommends --yes install dosfstools dpkg-dev e2fsprogs expect fdisk mmdebstrap mount mtools openssh-client ovmf qemu-efi-aarch64 qemu-efi-arm qemu-efi-riscv64 qemu-system arch-test qemu-user-static systemd systemd-ukify + - /lib/systemd/systemd-binfmt + - PATH=$(pwd)/bin:$PATH ./tests/efi-create-and-run.sh "$ARCHITECTURE" "$DEFAULT_SUITE" diff --git a/tests/create-and-run.sh b/tests/create-and-run.sh index 1d0a56d..fab04bc 100755 --- a/tests/create-and-run.sh +++ b/tests/create-and-run.sh @@ -69,4 +69,4 @@ debvm-waitssh -t 540 "$SSH_PORT" run_ssh "$@" poweroff wait -"$(dirname "$0")/shell_interaction.expect" -- -i "$IMAGE" +"$(dirname "$0")/shell_interaction.expect" -- debvm-run -i "$IMAGE" diff --git a/tests/efi-create-and-run.sh b/tests/efi-create-and-run.sh new file mode 100755 index 0000000..2b70662 --- /dev/null +++ b/tests/efi-create-and-run.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +if test "$#" -ne 2; then + echo "$(basename "$0") takes two positional arguments: architecture and release" 1>&2 + exit 1 +fi +ARCHITECTURE=$1 +RELEASE=$2 +SSH_KEYPATH=ssh_id +IMAGE=test.img + +set -eux + +. "$(dirname "$0")/test_common.sh" + +cleanup() { + rm -f "$SSH_KEYPATH" "$SSH_KEYPATH.pub" "$IMAGE" +} + +trap cleanup EXIT INT TERM QUIT + +ssh-keygen -f "$SSH_KEYPATH" -N '' +set -- -- +if test -z "$RELEASE"; then + # The ordering of maybe-merged-usr and + # copy-host-apt-sources-and-preferences is unfortunately the wrong way + # round. Therefore, we make debvm-create skip it and pass it ourselves. + # The final empty string is the mirror specification. + set -- \ + --skip=usrmerge \ + "$@" \ + --hook-dir=/usr/share/mmdebstrap/hooks/copy-host-apt-sources-and-preferences \ + --hook-dir=/usr/share/mmdebstrap/hooks/file-mirror-automount \ + --hook-dir=/usr/share/mmdebstrap/hooks/maybe-merged-usr \ + "" +fi +debefivm-create -k "$SSH_KEYPATH.pub" -o "$IMAGE" -r "$RELEASE" -a "$ARCHITECTURE" "$@" + +SSH_PORT=2222 +timeout 600s debefivm-run -s "$SSH_PORT" -i "$IMAGE" & +set -- localhost +debvm-waitssh -t 540 "$SSH_PORT" +run_ssh "$@" poweroff +wait + +"$(dirname "$0")/shell_interaction.expect" -- debefivm-run -i "$IMAGE" diff --git a/tests/shell_interaction.expect b/tests/shell_interaction.expect index 325e476..72f8676 100755 --- a/tests/shell_interaction.expect +++ b/tests/shell_interaction.expect @@ -1,7 +1,7 @@ #!/usr/bin/expect set args [lrange $argv 0 end] set timeout 300 -spawn debvm-run {*}$args +spawn {*}$args expect "root@testvm:~#" set timeout 10 send "echo 6coF0JBW\$((2+3))\r" |