Skip to contentSkip to conversation

support/testing: test_xen: more robust network

PATCH In review Vincent Stehlé 2 participants 2 messages Nov 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/testing: test_xen: more robust network

The test tests.package.test_xen.TestXenArmv7 has become unstable after commit 24ff258905df ("support/testing: test_xen: add networking"), leading to a ~50% chance of failure on gitlab CI.

This seems to happen only with 32b (not with the 64b TestXenAarch64), only with Qemu < 9.1, and when this happens the test will hang during a step involving the simulated network and the dom1 (DHCP or ping).

The root cause is suspected to be a bug in the virtio-net hardware emulation of the qemu version 7.2.15 included in the Buildroot docker image.

As a workaround, remove all network interactions between dom1 and the simulated network:
- Instead of the gateway, ping dom0 from dom1.
- Instead of using DHCP, configure the network with fixed IP addresses, so that we know the IP address of the dom0.

A possible solution could have been to compile a host-qemu within the test, by adding BR2_PACKAGE_HOST_QEMU=y and BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y in the test configuration. This would have used the current Buildroot version (10.1.0) not affected by this issue, but this would also have significantly increased the test compilation time.

Since the DHCP is not really needed here to test the Xen networking capability, this is why the network configuration simplification was preferred here.

After those changes both Xen tests are stable on CI and locally.

---
 support/testing/tests/package/test_xen.py | 34 ++++++++++++-----------
 1 file changed, 18 insertions(+), 16 deletions(-)
support/testing/tests/package/test_xen.py +18 -16
index 511363be40..6f2da05d3a 100644
@@ -51,17 +51,21 @@ class TestXenBase(infra.basetest.BRTest):
 
         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.
+                    :       dom0          :   dom1    :
+                    :                     :           :
+                    :        br0          :           :
+                    :     10.0.2.42       :           :
+             gw     :         |           :           :
+          10.0.2.2 -:- eth0 --+-- vif1.0 -:-- eth0    :
+                    :                     : 10.0.2.43 :
+
+        The VMs use static IP addresses.
+        We create a bridge in dom0, which allows dom0 to reach the gateway.
         vif1.0 is added to the bridge automatically when dom1 is created.
+
+        There is a stability issue for Armv7 with Qemu < 9.1, which makes the
+        dom1 -> gw connection unreliable. As a workaround, we interact only with
+        dom0 from dom1 (hence the fixed IP addresses).
         """
 
         # Boot the emulator.
@@ -87,8 +91,7 @@ class TestXenBase(infra.basetest.BRTest):
 
         # 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 br0 10.0.2.42")
         self.assertRunOk("ifconfig -a")
 
         # Verify that we can ping the gateway.
@@ -103,12 +106,11 @@ class TestXenBase(infra.basetest.BRTest):
         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 eth0 10.0.2.43")
         self.assertRunOk("ifconfig -a")
 
-        # Verify that we can ping the gateway.
-        self.assertRunOk("ping -c 3 -A 10.0.2.2")
+        # Verify that we can ping the dom0.
+        self.assertRunOk("ping -c 3 -A 10.0.2.42")
 
         # Detach from dom1's console with CTRL-].
         # dom1 is still running in the background after that.
Signature · 6 lines
2.51.0

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

The test tests.package.test_xen.TestXenArmv7 has become unstable after commit 24ff258905df ("support/testing: test_xen: add networking"), leading to a ~50% chance of failure on gitlab CI.

This seems to happen only with 32b (not with the 64b TestXenAarch64), only with Qemu < 9.1, and when this happens the test will hang during a step involving the simulated network and the dom1 (DHCP or ping).

The root cause is suspected to be a bug in the virtio-net hardware emulation of the qemu version 7.2.15 included in the Buildroot docker image.

As a workaround, remove all network interactions between dom1 and the simulated network:
- Instead of the gateway, ping dom0 from dom1.
- Instead of using DHCP, configure the network with fixed IP addresses, so that we know the IP address of the dom0.

A possible solution could have been to compile a host-qemu within the test, by adding BR2_PACKAGE_HOST_QEMU=y and BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y in the test configuration. This would have used the current Buildroot version (10.1.0) not affected by this issue, but this would also have significantly increased the test compilation time.

Since the DHCP is not really needed here to test the Xen networking capability, this is why the network configuration simplification was preferred here.

Quoted 5 lines

After those changes both Xen tests are stable on CI and locally.

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