summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-08-13 11:13:27 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-08-13 11:34:23 +0200
commita2c00ecbe9e5313a6dd9417e6e31bf6a703cc245 (patch)
treef232ffa73cc2c6d04720f9feb454ac83fd3cd2a4
parentf35ef9a20fabfd6e57db83136dc4486fe7757bdc (diff)
downloaddebvm-a2c00ecbe9e5313a6dd9417e6e31bf6a703cc245.tar.gz
test for autologin to work using expect
-rw-r--r--.gitlab-ci.yml6
-rw-r--r--debian/tests/control4
-rwxr-xr-xtests/create-and-run.sh2
-rwxr-xr-xtests/shell_interaction.expect15
4 files changed, 22 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 24cbab1..8307ff6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,14 +28,14 @@ release_test:
script:
- apt-get update
- apt-get dist-upgrade --yes
- - apt-get --no-install-recommends --yes install curl e2fsprogs mmdebstrap openssh-client qemu-kvm dpkg-dev
+ - apt-get --no-install-recommends --yes install curl e2fsprogs expect mmdebstrap openssh-client qemu-kvm dpkg-dev
- PATH=$(pwd)/bin:$PATH ./tests/create-and-run.sh $(dpkg --print-architecture) "$RELEASE"
debci_test:
script:
- apt-get update
- apt-get dist-upgrade --yes
- - apt-get --no-install-recommends --yes install e2fsprogs mmdebstrap openssh-client qemu-kvm dpkg-dev
+ - apt-get --no-install-recommends --yes install e2fsprogs expect mmdebstrap openssh-client qemu-kvm dpkg-dev
- PATH=$(pwd)/bin:$PATH ./tests/create-and-run.sh $(dpkg --print-architecture) ""
arch_test:
@@ -54,6 +54,6 @@ arch_test:
- 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 curl e2fsprogs mmdebstrap openssh-client qemu-system arch-test qemu-user-static file systemd dpkg-dev debian-ports-archive-keyring
+ - 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" sid
diff --git a/debian/tests/control b/debian/tests/control
index 8c506ff..4f4bba3 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,11 +1,11 @@
Test-Command: setsid ./tests/create-and-run.sh $(dpkg --print-architecture) ""
-Depends: debian-archive-keyring, debvm, file, openssh-client, seabios [ppc64el]
+Depends: debian-archive-keyring, debvm, expect, file, openssh-client, seabios [ppc64el]
Restrictions: allow-stderr, needs-internet, needs-root
# Skip running on armel and armhf as the emulation is too slow there to actually work.
Architecture: !armel !armhf
Test-Command: unshare -U -m -p -f -r --mount-proc true || exit 77; ./tests/create-and-run.sh $(dpkg --print-architecture) ""
-Depends: debian-archive-keyring, debvm, file, openssh-client, seabios [ppc64el], uidmap
+Depends: debian-archive-keyring, debvm, expect, file, openssh-client, seabios [ppc64el], uidmap
Restrictions: allow-stderr, needs-internet, skippable
# Skip running on armel and armhf as the emulation is too slow there to actually work.
Architecture: !armel !armhf
diff --git a/tests/create-and-run.sh b/tests/create-and-run.sh
index 228ca6c..2553a21 100755
--- a/tests/create-and-run.sh
+++ b/tests/create-and-run.sh
@@ -58,3 +58,5 @@ test "$RELEASE" = jessie && set -- -o PubkeyAcceptedKeyTypes=+ssh-rsa "$@"
debvm-waitssh -t 540 "$SSH_PORT"
run_ssh "$@" poweroff
wait
+
+"$(dirname "$0")/shell_interaction.expect" -- -i "$IMAGE"
diff --git a/tests/shell_interaction.expect b/tests/shell_interaction.expect
new file mode 100755
index 0000000..325e476
--- /dev/null
+++ b/tests/shell_interaction.expect
@@ -0,0 +1,15 @@
+#!/usr/bin/expect
+set args [lrange $argv 0 end]
+set timeout 300
+spawn debvm-run {*}$args
+expect "root@testvm:~#"
+set timeout 10
+send "echo 6coF0JBW\$((2+3))\r"
+expect {
+ "6coF0JBW5" { }
+ timeout { exit 1 }
+}
+expect "root@testvm:~#"
+send "poweroff\r"
+set timeout 120
+expect eof