Skip to contentSkip to conversation

support/testing: test_xen: add networking

PATCH In review Vincent Stehlé 2 participants 2 messages Oct 15, 2025 – Oct 16, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 support/testing: test_xen: add networking

Enhance the Xen python tests to exercise networking:

- Add the networking support we need to the Linux kernel configurations.
- Add a virtual network interface to the Xen dom1 configurations.
- Update the test in the following way:
* Start the emulator with restricted networking.
* Create a network bridge in dom0.
* Check that networking is functional in both domains by ping'ing the gateway.
(Refer also to the diagram in the python script.)
- While at it, bump Linux kernel to 6.17.1 and U-Boot to 2025.07. We also need to adjust the DTB address in the Arm 32b U-Boot script to accommodate the new U-Boot version, which does not have enough free space around the control DTB anymore.
We disable IPv6 in both kernel configurations to make the 32b test pass on gitlab CI.

---

Changes v1 -> v2:
- Disable IPv6 to make the Armv7 test pass on gitlab CI with "old" Qemu.

Hi,

Tracing with tcpdump revealed that (useless) IPv6 frames were exchanged during the test, with different timings between the 64b and 32b cases; a hint that it might have an influence.
As disabling IPv6 completely does indeed repair the 32b test on gitlab with "old" Qemu, and as we do not need IPv6 at all, let's disable IPv6 across the board for symmetry.

Best regards,
Vincent.

 support/testing/tests/package/test_xen.py     | 48 ++++++++++++++++++-
 .../package/test_xen/aarch64/linux.config     | 44 +++--------------
 .../test_xen/aarch64/overlay/etc/xen/dom1.cfg |  1 +
 .../tests/package/test_xen/arm/boot.cmd       |  4 +-
 .../tests/package/test_xen/arm/linux.config   |  6 ++-
 .../test_xen/arm/overlay/etc/xen/dom1.cfg     |  1 +
 6 files changed, 60 insertions(+), 44 deletions(-)
support/testing/tests/package/test_xen.py +46 -2
index 881327b9b9..511363be40 100644
@@ -14,9 +14,10 @@ class TestXenBase(infra.basetest.BRTest):
         BR2_ROOTFS_POST_BUILD_SCRIPT="support/testing/tests/package/test_xen/common/post-build.sh"
         BR2_LINUX_KERNEL=y
         BR2_LINUX_KERNEL_CUSTOM_VERSION=y
-        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.9"
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.17.1"
         BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
         BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+        BR2_PACKAGE_BRIDGE_UTILS=y
         BR2_PACKAGE_XEN=y
         BR2_PACKAGE_XEN_HYPERVISOR=y
         BR2_PACKAGE_XEN_TOOLS=y
@@ -25,7 +26,7 @@ class TestXenBase(infra.basetest.BRTest):
         BR2_TARGET_UBOOT=y
         BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
         BR2_TARGET_UBOOT_CUSTOM_VERSION=y
-        BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2025.01"
+        BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2025.07"
         BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
         BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
         BR2_PACKAGE_HOST_DOSFSTOOLS=y
@@ -47,6 +48,20 @@ class TestXenBase(infra.basetest.BRTest):
     def run_xen_test(self, arch: str, options: list[str]) -> None:
         """This functions tests Xen for multiple architectures.
         The arch and options parameters are passed to the emulator.
+
+        Here is the network setup we use in the test:
+
+                    :         dom0        :   dom1   :
+                    :                     :          :
+                    :        br0          :          :
+                    :      10.0.2.x       :          :
+             gw     :         |           :          :
+          10.0.2.2 -:- eth0 --+-- vif1.0 -:-- eth0   :
+                    :                     : 10.0.2.y :
+
+        The VMs get their IP addresses with DHCP.
+        We create a bridge in dom0, which allows dom1 to reach the gateway.
+        vif1.0 is added to the bridge automatically when dom1 is created.
         """
 
         # Boot the emulator.
@@ -65,6 +80,20 @@ class TestXenBase(infra.basetest.BRTest):
         # Check that we have one VM running.
         self.assertNumVM(1)
 
+        # Create a network bridge.
+        self.assertRunOk("brctl addbr br0")
+        self.assertRunOk("brctl addif br0 eth0")
+        self.assertRunOk("brctl show")
+
+        # Bring up the network in the dom0.
+        self.assertRunOk("ifconfig eth0 up")
+        self.assertRunOk("ifconfig br0 up")
+        self.assertRunOk("udhcpc -i br0")
+        self.assertRunOk("ifconfig -a")
+
+        # Verify that we can ping the gateway.
+        self.assertRunOk("ping -c 3 -A 10.0.2.2")
+
         # Create dom1 with console attached and login.
         self.emulator.qemu.sendline("xl create -c /etc/xen/dom1.cfg")
         self.emulator.login()
@@ -73,6 +102,14 @@ class TestXenBase(infra.basetest.BRTest):
         uuid = self.get_dom_uuid()
         self.assertNotEqual(uuid, dom0_uuid, "Unexpected dom0 UUID")
 
+        # Bring up the network in the dom1.
+        self.assertRunOk("ifconfig eth0 up")
+        self.assertRunOk("udhcpc -i eth0")
+        self.assertRunOk("ifconfig -a")
+
+        # Verify that we can ping the gateway.
+        self.assertRunOk("ping -c 3 -A 10.0.2.2")
+
         # Detach from dom1's console with CTRL-].
         # dom1 is still running in the background after that.
         self.emulator.qemu.send(chr(0x1d))
@@ -88,6 +125,9 @@ class TestXenBase(infra.basetest.BRTest):
         # Check that we have two VMs running.
         self.assertNumVM(2)
 
+        # Print the bridge setup for debugging.
+        self.assertRunOk("brctl show")
+
 
 class TestXenAarch64(TestXenBase):
     # Test Xen on 64b Arm.
@@ -117,8 +157,10 @@ class TestXenAarch64(TestXenBase):
             "-bios", uboot_bin,
             "-cpu", "cortex-a53",
             "-device", "virtio-blk-device,drive=hd0",
+            "-device", "virtio-net-device,netdev=eth0",
             "-drive", f"file={disk_img},if=none,format=raw,id=hd0",
             "-m", "1G",
+            "-netdev", "user,id=eth0,restrict=yes",
             "-machine", "virt,gic-version=3,virtualization=on,acpi=off",
             "-smp", "2"
         ]
@@ -158,9 +200,11 @@ class TestXenArmv7(TestXenBase):
             "-bios", uboot_bin,
             "-cpu", "cortex-a15",
             "-device", "virtio-blk-device,drive=hd0",
+            "-device", "virtio-net-device,netdev=eth0",
             "-drive", f"file={disk_img},if=none,format=raw,id=hd0",
             "-m", "1G",
             "-machine", "virt,virtualization=on,acpi=off",
+            "-netdev", "user,id=eth0,restrict=yes",
             "-smp", "2"
         ]
 
support/testing/tests/package/test_xen/aarch64/linux.config +6 -38

84 lines not on this page · raw message

support/testing/tests/package/test_xen/aarch64/overlay/etc/xen/dom1.cfg +1 -0
index 869c12beb8..651b8de919 100644
@@ -3,3 +3,4 @@ kernel="/mnt/Image"
 ramdisk="/mnt/rootfs.cpio"
 memory=256
 cmdline="console=hvc0"
+vif=['bridge=br0']
support/testing/tests/package/test_xen/arm/boot.cmd +2 -2
index 698e055e56..859dc661c8 100644
@@ -1,4 +1,4 @@
-fdt addr ${fdtcontroladdr}
+fdt addr ${fdt_addr}
 fdt resize
 
 fdt set /chosen \#address-cells <1>
@@ -20,4 +20,4 @@ load ${devtype} ${devnum} ${loadaddr} xen
 fdt set /chosen xen,dom0-bootargs "console=hvc0"
 fdt set /chosen xen,xen-bootargs "dom0_mem=256M loglvl=all guest_loglvl=all"
 fdt print /chosen
-bootz ${loadaddr} - ${fdtcontroladdr}
+bootz ${loadaddr} - ${fdt_addr}
support/testing/tests/package/test_xen/arm/linux.config +4 -2
index aedd9bf0a2..0a58785f73 100644
@@ -23,6 +23,7 @@ CONFIG_VFP=y
 CONFIG_NEON=y
 CONFIG_KERNEL_MODE_NEON=y
 # CONFIG_SUSPEND is not set
+# CONFIG_GCC_PLUGINS is not set
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_PARTITION_ADVANCED=y
@@ -38,6 +39,8 @@ CONFIG_IP_PNP=y
 CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
 CONFIG_IP_PNP_RARP=y
+# CONFIG_IPV6 is not set
+CONFIG_BRIDGE=y
 CONFIG_QRTR=m
 CONFIG_PAGE_POOL_STATS=y
 CONFIG_DEVTMPFS=y
@@ -69,6 +72,7 @@ CONFIG_DWMAC_DWC_QOS_ETH=y
 CONFIG_MDIO_BITBANG=y
 CONFIG_MDIO_MSCC_MIIM=m
 # CONFIG_WLAN is not set
+CONFIG_XEN_NETDEV_BACKEND=y
 CONFIG_INPUT_EVDEV=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_GPIO_DECODER=m
@@ -153,11 +157,9 @@ CONFIG_TMPFS_POSIX_ACL=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_UTF8=y
-CONFIG_CRC_CCITT=m
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
 CONFIG_DEBUG_INFO_REDUCED=y
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_FS=y
-# CONFIG_SCHED_DEBUG is not set
 # CONFIG_FTRACE is not set
support/testing/tests/package/test_xen/arm/overlay/etc/xen/dom1.cfg +1 -0
index 0a4ae24a16..3c75a0cfb7 100644
@@ -3,3 +3,4 @@ kernel="/mnt/zImage"
 ramdisk="/mnt/rootfs.cpio"
 memory=256
 cmdline="console=hvc0"
+vif=['bridge=br0']
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 21 lines · Vincent Stehlé

Enhance the Xen python tests to exercise networking:

- Add the networking support we need to the Linux kernel configurations.
- Add a virtual network interface to the Xen dom1 configurations.
- Update the test in the following way:
* Start the emulator with restricted networking.
* Create a network bridge in dom0.
* Check that networking is functional in both domains by ping'ing the gateway.
(Refer also to the diagram in the python script.)
- While at it, bump Linux kernel to 6.17.1 and U-Boot to 2025.07. We also need to adjust the DTB address in the Arm 32b U-Boot script
to
accommodate the new U-Boot version, which does not have enough free
space
around the control DTB anymore.
We disable IPv6 in both kernel configurations to make the 32b test
pass
on gitlab CI.

Quoted 1 line

Applied to master, thanks!
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot