tests: Avoid confusing "DETACH failed" exception prints in D-Bus tests
dbus_p2p_go_neg_init, dbus_p2p_group_idle_timeout, and dbus_p2p_group_termination_by_go could end up print a "DETACH failed" exception as a warning from WpaSupplicant.__del__ for the dev1 instance used within the TestDbusP2p class. This did not cause the test cases to fail, but the output is a bit confusing, so clean this up be explicitly closing the control interface monitor sockets and furthermore by ignoring the "DETACH failed" exception within __del__. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
c975c667f8
commit
6541b9dbe7
2 changed files with 23 additions and 3 deletions
|
@ -4593,6 +4593,9 @@ def test_dbus_p2p_go_neg_init(dev, apdev):
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("Group formation timed out")
|
raise Exception("Group formation timed out")
|
||||||
self.sta_group_ev = ev
|
self.sta_group_ev = ev
|
||||||
|
dev1.close_monitor_global()
|
||||||
|
dev1.close_monitor_mon()
|
||||||
|
dev1 = None
|
||||||
|
|
||||||
def goNegotiationSuccess(self, properties):
|
def goNegotiationSuccess(self, properties):
|
||||||
logger.debug("goNegotiationSuccess: properties=%s" % str(properties))
|
logger.debug("goNegotiationSuccess: properties=%s" % str(properties))
|
||||||
|
@ -4603,9 +4606,10 @@ def test_dbus_p2p_go_neg_init(dev, apdev):
|
||||||
properties['interface_object'])
|
properties['interface_object'])
|
||||||
group_p2p = dbus.Interface(g_if_obj, WPAS_DBUS_IFACE_P2PDEVICE)
|
group_p2p = dbus.Interface(g_if_obj, WPAS_DBUS_IFACE_P2PDEVICE)
|
||||||
group_p2p.Disconnect()
|
group_p2p.Disconnect()
|
||||||
dev1 = WpaSupplicant('wlan1', '/tmp/wpas-wlan1')
|
dev1 = WpaSupplicant('wlan1', '/tmp/wpas-wlan1', monitor=False)
|
||||||
dev1.group_form_result(self.sta_group_ev)
|
dev1.group_form_result(self.sta_group_ev)
|
||||||
dev1.remove_group()
|
dev1.remove_group()
|
||||||
|
dev1 = None
|
||||||
|
|
||||||
def groupFinished(self, properties):
|
def groupFinished(self, properties):
|
||||||
logger.debug("groupFinished: " + str(properties))
|
logger.debug("groupFinished: " + str(properties))
|
||||||
|
@ -4688,6 +4692,9 @@ def test_dbus_p2p_group_termination_by_go(dev, apdev):
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("Group formation timed out")
|
raise Exception("Group formation timed out")
|
||||||
self.sta_group_ev = ev
|
self.sta_group_ev = ev
|
||||||
|
dev1.close_monitor_global()
|
||||||
|
dev1.close_monitor_mon()
|
||||||
|
dev1 = None
|
||||||
|
|
||||||
def goNegotiationSuccess(self, properties):
|
def goNegotiationSuccess(self, properties):
|
||||||
logger.debug("goNegotiationSuccess: properties=%s" % str(properties))
|
logger.debug("goNegotiationSuccess: properties=%s" % str(properties))
|
||||||
|
@ -4696,7 +4703,7 @@ def test_dbus_p2p_group_termination_by_go(dev, apdev):
|
||||||
logger.debug("groupStarted: " + str(properties))
|
logger.debug("groupStarted: " + str(properties))
|
||||||
g_if_obj = bus.get_object(WPAS_DBUS_SERVICE,
|
g_if_obj = bus.get_object(WPAS_DBUS_SERVICE,
|
||||||
properties['interface_object'])
|
properties['interface_object'])
|
||||||
dev1 = WpaSupplicant('wlan1', '/tmp/wpas-wlan1')
|
dev1 = WpaSupplicant('wlan1', '/tmp/wpas-wlan1', monitor=False)
|
||||||
dev1.group_form_result(self.sta_group_ev)
|
dev1.group_form_result(self.sta_group_ev)
|
||||||
dev1.remove_group()
|
dev1.remove_group()
|
||||||
|
|
||||||
|
@ -4784,6 +4791,9 @@ def _test_dbus_p2p_group_idle_timeout(dev, apdev):
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("Group formation timed out")
|
raise Exception("Group formation timed out")
|
||||||
self.sta_group_ev = ev
|
self.sta_group_ev = ev
|
||||||
|
dev1.close_monitor_global()
|
||||||
|
dev1.close_monitor_mon()
|
||||||
|
dev1 = None
|
||||||
|
|
||||||
def goNegotiationSuccess(self, properties):
|
def goNegotiationSuccess(self, properties):
|
||||||
logger.debug("goNegotiationSuccess: properties=%s" % str(properties))
|
logger.debug("goNegotiationSuccess: properties=%s" % str(properties))
|
||||||
|
@ -4793,7 +4803,7 @@ def _test_dbus_p2p_group_idle_timeout(dev, apdev):
|
||||||
self.group_started = True
|
self.group_started = True
|
||||||
g_if_obj = bus.get_object(WPAS_DBUS_SERVICE,
|
g_if_obj = bus.get_object(WPAS_DBUS_SERVICE,
|
||||||
properties['interface_object'])
|
properties['interface_object'])
|
||||||
dev1 = WpaSupplicant('wlan1', '/tmp/wpas-wlan1')
|
dev1 = WpaSupplicant('wlan1', '/tmp/wpas-wlan1', monitor=False)
|
||||||
dev1.group_form_result(self.sta_group_ev)
|
dev1.group_form_result(self.sta_group_ev)
|
||||||
ifaddr = dev1.group_request("STA-FIRST").splitlines()[0]
|
ifaddr = dev1.group_request("STA-FIRST").splitlines()[0]
|
||||||
# Force disassociation with different reason code so that the
|
# Force disassociation with different reason code so that the
|
||||||
|
|
|
@ -85,6 +85,11 @@ class WpaSupplicant:
|
||||||
self.mon.detach()
|
self.mon.detach()
|
||||||
except ConnectionRefusedError:
|
except ConnectionRefusedError:
|
||||||
pass
|
pass
|
||||||
|
except Exception as e:
|
||||||
|
if str(e) == "DETACH failed":
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise
|
||||||
del self.mon
|
del self.mon
|
||||||
self.mon = None
|
self.mon = None
|
||||||
|
|
||||||
|
@ -101,6 +106,11 @@ class WpaSupplicant:
|
||||||
self.global_mon.detach()
|
self.global_mon.detach()
|
||||||
except ConnectionRefusedError:
|
except ConnectionRefusedError:
|
||||||
pass
|
pass
|
||||||
|
except Exception as e:
|
||||||
|
if str(e) == "DETACH failed":
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise
|
||||||
del self.global_mon
|
del self.global_mon
|
||||||
self.global_mon = None
|
self.global_mon = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue