[PATCH v5 11/13] CI: Extend qemu-alpine-lib.sh to allow simple networking test

Marek Marczykowski-Górecki <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <22516b48ec472a1c507cf62a44856a4912037eaf.1785941707.git-series.marmarek@invisiblethingslab.com>
Allow some tests do a little more reliable test if a domU is still
alive.

Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
New in v5
---
 automation/scripts/qemu-alpine-lib.sh | 31 +++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/automation/scripts/qemu-alpine-lib.sh b/automation/scripts/qemu-alpine-lib.sh
index 2d306f384f6f..7f0046888325 100755
--- a/automation/scripts/qemu-alpine-lib.sh
+++ b/automation/scripts/qemu-alpine-lib.sh
@@ -1,5 +1,25 @@
 #!/bin/bash
 
+dom0_test="
+xl list
+
+xl -vvv create -c /root/domU.cfg
+"
+
+domU_test=""
+domU_config_add=""
+
+# snippets to be used in $dom[0U]_test
+dom0_setup_network="
+brctl addbr xenbr0
+ip link set xenbr0 up
+ip addr add 192.168.0.1/24 dev xenbr0
+"
+domU_setup_network="
+ip link set eth0 up
+ip addr add 192.168.0.2/24 dev eth0
+"
+
 build_domU() {
     # DomU Busybox
     mkdir -p initrd
@@ -19,6 +39,9 @@ build_domU() {
 mount -t proc proc /proc
 mount -t sysfs sysfs /sys
 mount -t devtmpfs devtmpfs /dev
+
+$domU_test
+
 /bin/sh" > initrd/init
     chmod +x initrd/init
     # DomU rootfs
@@ -46,7 +69,8 @@ build_dom0() {
     vcpus=1
     kernel=\"/root/bzImage\"
     ramdisk=\"/root/domU-rootfs.cpio.gz\"
-    extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh oops=panic\"
+    extra=\"console=hvc0 root=/dev/ram0 rdinit=/init oops=panic\"
+    $domU_config_add
     " > root/domU.cfg
     echo "#!/bin/bash
 
@@ -54,10 +78,7 @@ build_dom0() {
 
     bash /etc/init.d/xencommons start
 
-    xl list
-
-    xl -vvv create -c /root/domU.cfg
-
+    $dom0_test
     " > etc/local.d/xen.start
     chmod +x etc/local.d/xen.start
     find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
-- 
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.