[PATCH v5 12/13] CI: Add simple domU suspend test

Marek Marczykowski-Górecki <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <dc30d924d8c2fa51275b660943f05da0ad541ee3.1785941707.git-series.marmarek@invisiblethingslab.com>
Regression test for https://lore.kernel.org/xen-devel/ajUm2SQtMD6Y-K9S@mail-itl/

Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
New in v5
---
 automation/gitlab-ci/test.yaml                        |  8 +-
 automation/scripts/qemu-alpine-domU-suspend-x86_64.sh | 71 ++++++++++++-
 2 files changed, 79 insertions(+)
 create mode 100755 automation/scripts/qemu-alpine-domU-suspend-x86_64.sh

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 1359d70ff2b4..b7cdb3a3eb09 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -752,6 +752,14 @@ qemu-alpine-driverdomains-x86_64-gcc:
     - *x86_64-test-needs
     - alpine-3.24-x86_64-gcc
 
+qemu-alpine-domU-suspend-x86_64-gcc:
+  extends: .qemu-x86_64
+  script:
+    - ./automation/scripts/qemu-alpine-domU-suspend-x86_64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86_64-test-needs
+    - alpine-3.24-x86_64-gcc
+
 qemu-debian-13-driverdomains-x86_64-gcc:
   extends: .qemu-x86_64
   script:
diff --git a/automation/scripts/qemu-alpine-domU-suspend-x86_64.sh b/automation/scripts/qemu-alpine-domU-suspend-x86_64.sh
new file mode 100755
index 000000000000..f46a40b67306
--- /dev/null
+++ b/automation/scripts/qemu-alpine-domU-suspend-x86_64.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+set -ex -o pipefail
+
+. "$(dirname "$0")"/qemu-alpine-lib.sh
+
+dom0_test="
+
+$dom0_setup_network
+
+set -ex
+
+tail -F /var/log/xen/console/guest-domU.log 2>/dev/null | sed -e \"s/^/(domU) /\" &
+xl -vvv create /root/domU.cfg
+sleep 10
+ping -c 3 192.168.0.2
+xl -vvv suspend domU
+sleep 2
+xl -vvv resume domU
+sleep 2
+xl list domU
+alive_test=\$(nc 192.168.0.2 8888 </dev/null)
+test \"\$alive_test\" = \"Still alive\"
+# try again
+xl -vvv suspend domU
+sleep 2
+xl -vvv resume domU
+sleep 2
+xl list domU
+alive_test=\$(nc 192.168.0.2 8888 </dev/null)
+test \"\$alive_test\" = \"Still alive\"
+echo Test result: \$?
+"
+
+domU_test="$domU_setup_network
+
+nc -ll -p 8888 -e sh -c 'echo Still alive'
+"
+domU_config_add="vif=[ 'bridge=xenbr0' ]"
+
+cd binaries
+build_domU
+build_dom0
+cd ..
+
+cat >> binaries/pxelinux.0 << EOF
+#!ipxe
+
+kernel xen console=com1 console_timestamps=boot dom0_mem=1024M
+module bzImage console=hvc0 oops=panic
+module dom0-rootfs.cpio.gz
+boot
+EOF
+
+# Run the test
+rm -f smoke.serial
+export TEST_CMD="qemu-system-x86_64 \
+    -cpu qemu64,+svm \
+    -m 2G -smp 2 \
+    -monitor none -serial stdio \
+    -nographic \
+    -device virtio-net-pci,netdev=n0 \
+    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
+
+export TEST_LOG="smoke.serial"
+export BOOT_MSG="Latest ChangeSet: "
+export LOG_MSG="Welcome to Alpine"
+export PASSED="Test result: 0"
+export TEST_TIMEOUT="180"
+
+./automation/scripts/console.exp |& sed 's/\r\+$//'
-- 
git-series 0.9.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.