From: Jouni Malinen Date: Fri, 22 Aug 2025 09:47:48 +0000 (+0300) Subject: tests: Make dbus_connect_oom more robust X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9001059bd6ad3613f07e0824bf7cd7010e4c41a9;p=thirdparty%2Fhostap.git tests: Make dbus_connect_oom more robust Retry RemoveNetwork() and SelectNetwork() if they fail due to InvalidArgs error. That error is returned if a memory allocation fails and that is indeed what this test case is trying to trigger. In addition, dump any potential hostapd event messages between each test interation to keep the logs clearer and the socket buffer smaller. Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index dfc20db3a..bc88c03af 100644 --- a/tests/hwsim/test_dbus.py +++ b/tests/hwsim/test_dbus.py @@ -1614,11 +1614,27 @@ def test_dbus_connect_oom(dev, apdev): if 'frequency' not in res or res['frequency'] != 2412: self.state = -1 logger.info("Unexpected SignalPoll result") - iface.RemoveNetwork(self.netw) + try: + iface.RemoveNetwork(self.netw) + except dbus.exceptions.DBusException as e: + # Work around known issues caused by OOM messing up with + # D-Bus message processing. + if "InvalidArgs" in str(e): + iface.RemoveNetwork(self.netw) + else: + raise if 'State' in properties and properties['State'] == "disconnected": if self.state == 1: self.state = 2 - iface.SelectNetwork(self.netw) + try: + iface.SelectNetwork(self.netw) + except dbus.exceptions.DBusException as e: + # Work around known issues caused by OOM messing up with + # D-Bus message processing. + if "InvalidArgs" in str(e): + iface.SelectNetwork(self.netw) + else: + raise elif self.state == 3: self.state = 4 iface.Reassociate() @@ -1656,6 +1672,7 @@ def test_dbus_connect_oom(dev, apdev): count = 0 for i in range(1, 1000): + hapd.dump_monitor() for j in range(3): dev[j].dump_monitor() dev[0].request("TEST_ALLOC_FAIL %d:main" % i)