dbus_p2p_discovery sometimes fails
Vasyl Vavrychuk
vvavrychuk at gmail.com
Thu Feb 1 23:36:23 PST 2018
dbus_p2p_discovery tests sometimes fails, approx 1 to 25 cases rate. I
would appreciate any suggestions. Thanks in advance.
In happy case logs are
2018-02-01 22:51:28,157 DEBUG run_test
2018-02-01 22:51:29,330 DEBUG deviceFound:
path=/fi/w1/wpa_supplicant1/Interfaces/1/Peers/020000000200
2018-02-01 22:51:29,466 DEBUG peer properties: dbus.Dictionary(...
2018-02-01 22:51:29,470 DEBUG deviceFoundProperties:
path=/fi/w1/wpa_supplicant1/Interfaces/1/Peers/020000000200
2018-02-01 22:51:29,470 DEBUG peer properties: dbus.Dictionary(...
2018-02-01 22:51:29,471 DEBUG deviceFound:
path=/fi/w1/wpa_supplicant1/Interfaces/1/Peers/020000000100
2018-02-01 22:51:29,494 DEBUG peer properties: dbus.Dictionary(...
2018-02-01 22:51:29,495 INFO Found both peers
In sad case logs are
2018-02-01 22:53:40,230 DEBUG run_test
2018-02-01 22:53:41,090 DEBUG deviceFound:
path=/fi/w1/wpa_supplicant1/Interfaces/1/Peers/020000000100
2018-02-01 22:53:41,170 DEBUG peer properties: dbus.Dictionary(...
2018-02-01 22:53:41,194 DEBUG deviceFoundProperties:
path=/fi/w1/wpa_supplicant1/Interfaces/1/Peers/020000000100
2018-02-01 22:53:41,202 DEBUG peer properties: dbus.Dictionary(...
2018-02-01 22:53:50,287 DEBUG findStopped
Logs are attached in archive, there is two happy and one sad case. I
run some simplified version of test pasted below.
def test_dbus_p2p_discovery(dev, apdev):
"""D-Bus P2P discovery"""
(bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
p2p = dbus.Interface(if_obj, WPAS_DBUS_IFACE_P2PDEVICE)
addr0 = dev[0].p2p_dev_addr()
dev[1].p2p_listen()
addr1 = dev[1].p2p_dev_addr()
a1 = binascii.unhexlify(addr1.replace(':',''))
dev[2].p2p_listen()
addr2 = dev[2].p2p_dev_addr()
a2 = binascii.unhexlify(addr2.replace(':',''))
class TestDbusP2p(TestDbus):
def __init__(self, bus):
TestDbus.__init__(self, bus)
self.found = False
self.found2 = False
self.found_prop = False
self.lost = False
self.find_stopped = False
def __enter__(self):
self.add_signal(self.deviceFound, WPAS_DBUS_IFACE_P2PDEVICE,
"DeviceFound")
self.add_signal(self.deviceFoundProperties,
WPAS_DBUS_IFACE_P2PDEVICE, "DeviceFoundProperties")
self.add_signal(self.findStopped, WPAS_DBUS_IFACE_P2PDEVICE,
"FindStopped")
gobject.timeout_add(1, self.run_test)
gobject.timeout_add(15000, self.timeout)
self.loop.run()
return self
def deviceFound(self, path):
logger.debug("deviceFound: path=%s" % path)
res = if_obj.Get(WPAS_DBUS_IFACE_P2PDEVICE, "Peers",
dbus_interface=dbus.PROPERTIES_IFACE)
if len(res) < 1:
raise Exception("Unexpected number of peers")
if path not in res:
raise Exception("Mismatch in peer object path")
peer_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
res = peer_obj.GetAll(WPAS_DBUS_P2P_PEER,
dbus_interface=dbus.PROPERTIES_IFACE,
byte_arrays=True)
logger.debug("peer properties: " + str(res))
if res['DeviceAddress'] == a1:
self.found = True
elif res['DeviceAddress'] == a2:
self.found2 = True
else:
raise Exception("Unexpected peer device address")
if self.found and self.found2:
logger.info("Found both peers")
p2p.StopFind()
def deviceFoundProperties(self, path, properties):
logger.debug("deviceFoundProperties: path=%s" % path)
logger.debug("peer properties: " + str(properties))
if properties['DeviceAddress'] == a1:
self.found_prop = True
def findStopped(self):
logger.debug("findStopped")
self.find_stopped = True
self.loop.quit()
def run_test(self, *args):
logger.debug("run_test")
p2p.Find(dbus.Dictionary({'DiscoveryType': 'social',
'Timeout': dbus.Int32(10)}))
return False
def success(self):
return self.found and self.found2 and self.find_stopped
with TestDbusP2p(bus) as t:
if not t.success():
raise Exception("Expected signals not seen")
dev[1].p2p_stop_find()
dev[2].p2p_stop_find()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus_p2p_discovery_logs.zip
Type: application/zip
Size: 217534 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/hostap/attachments/20180202/72f12a12/attachment-0001.zip>
More information about the Hostap
mailing list