[PATCH 6/7] tests: ensure the RoC is setup when the NAN frame arrives

Benjamin Berg benjamin at sipsolutions.net
Wed Jun 11 01:47:28 PDT 2025


From: Benjamin Berg <benjamin.berg at intel.com>

At least in UML it could sometimes happen that the RoC is ready only
slightly after the NAN frame is TXed (a few microseconds). Insert
a short sleep to prevent this race from happening.

Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 tests/hwsim/test_dbus.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py
index ffc59a181c..e07c6b94d1 100644
--- a/tests/hwsim/test_dbus.py
+++ b/tests/hwsim/test_dbus.py
@@ -6598,6 +6598,9 @@ def test_dbus_nan_usd_subscribe_followup(dev, apdev):
                                                     'srv_proto_type': 3,
                                                     'ssi': dbus.ByteArray(b'test')})
 
+            # Setting up the RoC takes a little bit of time. Avoid racing with
+            # the TX here by sleeping a little bit.
+            time.sleep(0.01)
             cmd = "NAN_PUBLISH service_name=_test srv_proto_type=3 ssi=6677 ttl=10"
             self.id1 = dev[1].request(cmd)
             if "FAIL" in self.id1:
@@ -6664,6 +6667,9 @@ def test_dbus_nan_usd_publish_followup(dev, apdev):
             if "FAIL" in id1:
                 raise Exception("NAN_SUBSCRIBE failed")
 
+            # Setting up the RoC takes a little bit of time. Avoid racing with
+            # the TX here by sleeping a little bit.
+            time.sleep(0.01)
             self.publish_id = iface.NANPublish({'srv_name': '_test',
                                                 'srv_proto_type': 2,
                                                 'ssi': dbus.ByteArray(b'test')})
-- 
2.49.0




More information about the Hostap mailing list