[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen stable-4.19] CI: Minor cleanup to qubes-x86-64.sh



commit 1dd4b60de136565f18a93988705b6372f9958935
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Oct 21 14:06:24 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Nov 11 18:16:35 2024 +0000

    CI: Minor cleanup to qubes-x86-64.sh
    
     * List all the test_variants and summerise what's going on
     * Use case rather than an if/else chain for $test_variant
     * Adjust indentation inside the case block
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
    (cherry picked from commit 6685a129c7864e3733afef09a2539ccd722a4380)
---
 automation/scripts/qubes-x86-64.sh | 84 +++++++++++++++++++++++---------------
 1 file changed, 50 insertions(+), 34 deletions(-)

diff --git a/automation/scripts/qubes-x86-64.sh 
b/automation/scripts/qubes-x86-64.sh
index bfa60c912a..306304e921 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -2,6 +2,13 @@
 
 set -ex
 
+# One of:
+#  - ""             PV dom0,  PVH domU
+#  - dom0pvh        PVH dom0, PVH domU
+#  - dom0pvh-hvm    PVH dom0, HVM domU
+#  - pci-hvm        PV dom0,  HVM domU + PCI Passthrough
+#  - pci-pv         PV dom0,  PV domU + PCI Passthrough
+#  - s3             PV dom0,  S3 suspend/resume
 test_variant=$1
 
 ### defaults
@@ -19,17 +26,18 @@ vif = [ "bridge=xenbr0", ]
 disk = [ ]
 '
 
-### test: smoke test & smoke test PVH & smoke test HVM
-if [ -z "${test_variant}" ] || [ "${test_variant}" = "dom0pvh" ] || [ 
"${test_variant}" = "dom0pvh-hvm" ]; then
-    passed="ping test passed"
-    domU_check="
+case "${test_variant}" in
+    ### test: smoke test & smoke test PVH & smoke test HVM
+    ""|"dom0pvh"|"dom0pvh-hvm")
+        passed="ping test passed"
+        domU_check="
 ifconfig eth0 192.168.0.2
 until ping -c 10 192.168.0.1; do
     sleep 1
 done
 echo \"${passed}\"
 "
-    dom0_check="
+        dom0_check="
 set +x
 until grep -q \"${passed}\" /var/log/xen/console/guest-domU.log; do
     sleep 1
@@ -37,12 +45,12 @@ done
 set -x
 echo \"${passed}\"
 "
-if [ "${test_variant}" = "dom0pvh" ] || [ "${test_variant}" = "dom0pvh-hvm" ]; 
then
-    extra_xen_opts="dom0=pvh"
-fi
+        if [ "${test_variant}" = "dom0pvh" ] || [ "${test_variant}" = 
"dom0pvh-hvm" ]; then
+            extra_xen_opts="dom0=pvh"
+        fi
 
-if [ "${test_variant}" = "dom0pvh-hvm" ]; then
-    domU_config='
+        if [ "${test_variant}" = "dom0pvh-hvm" ]; then
+            domU_config='
 type = "hvm"
 name = "domU"
 kernel = "/boot/vmlinuz"
@@ -52,17 +60,18 @@ memory = 512
 vif = [ "bridge=xenbr0", ]
 disk = [ ]
 '
-fi
-
-### test: S3
-elif [ "${test_variant}" = "s3" ]; then
-    passed="suspend test passed"
-    wait_and_wakeup="started, suspending"
-    domU_check="
+        fi
+        ;;
+
+    ### test: S3
+    "s3")
+        passed="suspend test passed"
+        wait_and_wakeup="started, suspending"
+        domU_check="
 ifconfig eth0 192.168.0.2
 echo domU started
 "
-    dom0_check="
+        dom0_check="
 until grep 'domU started' /var/log/xen/console/guest-domU.log; do
     sleep 1
 done
@@ -79,19 +88,20 @@ xl dmesg | grep 'Finishing wakeup from ACPI S3 state' || 
exit 1
 ping -c 10 192.168.0.2 || exit 1
 echo \"${passed}\"
 "
+        ;;
 
-### test: pci-pv, pci-hvm
-elif [ "${test_variant}" = "pci-pv" ] || [ "${test_variant}" = "pci-hvm" ]; 
then
+    ### test: pci-pv, pci-hvm
+    "pci-pv"|"pci-hvm")
 
-    if [ -z "$PCIDEV" ]; then
-        echo "Please set 'PCIDEV' variable with BDF of test network adapter" 
>&2
-        echo "Optionally set also 'PCIDEV_INTR' to 'MSI' or 'MSI-X'" >&2
-        exit 1
-    fi
+        if [ -z "$PCIDEV" ]; then
+            echo "Please set 'PCIDEV' variable with BDF of test network 
adapter" >&2
+            echo "Optionally set also 'PCIDEV_INTR' to 'MSI' or 'MSI-X'" >&2
+            exit 1
+        fi
 
-    passed="pci test passed"
+        passed="pci test passed"
 
-    domU_config='
+        domU_config='
 type = "'${test_variant#pci-}'"
 name = "domU"
 kernel = "/boot/vmlinuz"
@@ -104,7 +114,7 @@ pci = [ "'$PCIDEV',seize=1" ]
 on_reboot = "destroy"
 '
 
-    domU_check="
+        domU_check="
 set -x -e
 interface=eth0
 ip link set \"\$interface\" up
@@ -115,22 +125,28 @@ echo domU started
 pcidevice=\$(basename \$(readlink /sys/class/net/\$interface/device))
 lspci -vs \$pcidevice
 "
-    if [ -n "$PCIDEV_INTR" ]; then
-        domU_check="$domU_check
+        if [ -n "$PCIDEV_INTR" ]; then
+            domU_check="$domU_check
 lspci -vs \$pcidevice | fgrep '$PCIDEV_INTR: Enable+'
 "
-    fi
-    domU_check="$domU_check
+        fi
+        domU_check="$domU_check
 echo \"${passed}\"
 "
 
-    dom0_check="
+        dom0_check="
 tail -F /var/log/xen/qemu-dm-domU.log &
 until grep -q \"^domU Welcome to Alpine Linux\" 
/var/log/xen/console/guest-domU.log; do
     sleep 1
 done
 "
-fi
+        ;;
+
+    *)
+        echo "Unrecognised test_variant '${test_variant}'" >&2
+        exit 1
+        ;;
+esac
 
 # DomU
 mkdir -p rootfs
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.