From: Jouni Malinen Date: Sat, 21 Dec 2024 20:31:07 +0000 (+0200) Subject: tests: Make country code clearing in dbus_interface more robust X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e4078bb14ed16909adb189b800c6b404be1da64;p=thirdparty%2Fhostap.git tests: Make country code clearing in dbus_interface more robust Wait for the specific CTRL-EVENT-REGDOM-CHANGE events to try to avoid test failures due to some race conditions and the US country code being left effective at the end of the test case. Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index b2eca83ea..ab535a3ef 100644 --- a/tests/hwsim/test_dbus.py +++ b/tests/hwsim/test_dbus.py @@ -2017,17 +2017,32 @@ def test_dbus_interface(dev, apdev): finally: # Need to force P2P channel list update since the 'lo' interface # with driver=none ends up configuring default dualband channels. + dev[0].dump_monitor() dev[0].request("SET country US") ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1) if ev is None: ev = dev[0].wait_global_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1) + if ev is None or "alpha2=US" not in ev: + ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1) + ev = dev[0].wait_global_event(["CTRL-EVENT-REGDOM-CHANGE"], + timeout=1) + dev[0].dump_monitor() + dev[0].request("SET country 00") ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1) if ev is None: ev = dev[0].wait_global_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1) + if ev is None or "type=WORLD" not in ev: + ev = dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=1) + ev = dev[0].wait_global_event(["CTRL-EVENT-REGDOM-CHANGE"], + timeout=1) + subprocess.call(['iw', 'reg', 'set', '00']) + cc = dev[0].get_driver_status_field("country") + if cc != '00': + logger.info("Country code not cleared to 00: " + cc) def _test_dbus_interface(dev, apdev): (bus, wpas_obj, path, if_obj) = prepare_dbus(dev[0])