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

[PATCH v2 5/9] automation: use a case statement for the Xilinx arm64 test variants



xilinx-smoke-dom0less-arm64.sh checks the test variant in several
places, e.g. again for the passthrough settings when writing the
ImageBuilder config.

So, like qubes-x86_64.sh, select the variant in a single case statement,
which only sets variables, and make the rest of the script act on them.
Also reject unknown variants, instead of running with nothing to check.

Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
---
Changes in v2:
- New patch
---
 .../scripts/xilinx-smoke-dom0less-arm64.sh    | 53 +++++++++++++------
 1 file changed, 36 insertions(+), 17 deletions(-)

diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh 
b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 61d6c686f7..343937d422 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -2,11 +2,21 @@
 
 set -ex -o pipefail
 
+# One of:              Testing:
+#  - (none)              dom0less domU, ping dom0 via a vif
+#  - gem-passthrough     dom0less domU, ping the gateway via a passed through 
GEM
 test_variant=$1
 
-if [ -z "${test_variant}" ]; then
-    passed="ping test passed"
-    dom0_check="
+### defaults
+dom0_check=
+domU_passthrough_dtb=
+domU_passthrough_path=
+
+case "${test_variant}" in
+    ### test: smoke test
+    "")
+        passed="ping test passed"
+        dom0_check="
 brctl addbr xenbr0
 brctl addif xenbr0 eth0
 ifconfig eth0 up
@@ -14,29 +24,38 @@ ifconfig xenbr0 up
 ifconfig xenbr0 192.168.0.1
 xl network-attach 1 type=vif
 "
-    domU_check="
+        domU_check="
 until ifconfig eth0 192.168.0.2 &> /dev/null && ping -c 10 192.168.0.1; do
     sleep 30
 done
 echo \"${passed}\"
 "
-fi
+        ;;
 
-if [[ "${test_variant}" == "gem-passthrough" ]]; then
-    passed="${test_variant} test passed"
+    ### test: gem-passthrough
+    "gem-passthrough")
+        passed="${test_variant} test passed"
 
-    # For a passthroughed GEM:
-    # - bring up the network interface
-    # - dynamically assign IP
-    # - ping the default gateway
-    domU_check="
+        # For a passthroughed GEM:
+        # - bring up the network interface
+        # - dynamically assign IP
+        # - ping the default gateway
+        domU_check="
 set -ex
 ifconfig eth0 up
 udhcpc -i eth0 -n
 ping -c 10 \$(ip route | awk '/^default/ {print \$3}')
 echo \"${passed}\"
 "
-fi
+        domU_passthrough_dtb="eth0.dtb"
+        domU_passthrough_path="/amba/ethernet@ff0e0000"
+        ;;
+
+    *)
+        echo "Unrecognised test_variant '${test_variant}'" >&2
+        exit 1
+        ;;
+esac
 
 # DomU rootfs
 cp binaries/rootfs.cpio.gz binaries/domU-rootfs.cpio.gz
@@ -104,13 +123,13 @@ cp -f binaries/domU-rootfs.cpio.gz $TFTP/
 # export dtb to artifacts
 cp $TFTP/mpsoc_smmu.dtb .
 
-if [[ "${test_variant}" == "gem-passthrough" ]]; then
+if [ -n "${domU_passthrough_dtb}" ]; then
     echo "
-    DOMU_PASSTHROUGH_DTB[0]=\"eth0.dtb\"
-    DOMU_PASSTHROUGH_PATHS[0]=\"/amba/ethernet@ff0e0000\"" >> $TFTP/config
+    DOMU_PASSTHROUGH_DTB[0]=\"${domU_passthrough_dtb}\"
+    DOMU_PASSTHROUGH_PATHS[0]=\"${domU_passthrough_path}\"" >> $TFTP/config
 
     # export passthrough dtb to artifacts
-    cp $TFTP/eth0.dtb .
+    cp $TFTP/${domU_passthrough_dtb} .
 fi
 
 rm -rf imagebuilder
-- 
2.53.0



--
Julian Vetter | Vates Hypervisor & Kernel Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

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