Procházet zdrojové kódy

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.

Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/11871454648
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Julien Olivain <ju.o@free.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
Vincent Stehlé před 2 měsíci
rodič
revize
ec1b800718
1 změnil soubory, kde provedl 18 přidání a 16 odebrání
  1. 18 16
      support/testing/tests/package/test_xen.py

+ 18 - 16
support/testing/tests/package/test_xen.py

@@ -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.