From 7966674d734c7c56c2d33852fd3f42369bf18645 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 12 Oct 2015 15:36:46 +0300 Subject: [PATCH] tests: Fix dbus_interface to restore P2P channel list to default It was possible for the dbus_interface test case to leave the P2P channel lists with 5 GHz channels enabled due to the special driver=none case. This could make the following P2P test case fail due to selecting an unexpected channel. Fix this by forcing P2P channel list update at the end of the dbus_interface test case. This was triggering with the following hwsim test case sequence: dbus_interface p2ps_connect_adv_go_p2ps_method_group_iface. Signed-off-by: Jouni Malinen --- tests/hwsim/test_dbus.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index dba899e9f..cc94b1da9 100644 --- a/tests/hwsim/test_dbus.py +++ b/tests/hwsim/test_dbus.py @@ -1682,6 +1682,24 @@ def test_dbus_network_oom(dev, apdev): def test_dbus_interface(dev, apdev): """D-Bus CreateInterface/GetInterface/RemoveInterface parameters and error cases""" + try: + _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].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) + 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) + subprocess.call(['iw', 'reg', 'set', '00']) + +def _test_dbus_interface(dev, apdev): (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0]) wpas = dbus.Interface(wpas_obj, WPAS_DBUS_SERVICE)