tests: Fix WEXT testing

Commit afb2e8b891 ('tests: Store P2P
Device ifname in class WpaSupplicant') did not take into account the
possibility of capa.flags not existing in get_driver_status() and broke
WEXT test cases. Fix this by checking that capa.flags is present before
looking at its value.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2016-05-14 18:59:47 +03:00
parent a185e9b10b
commit 50d06776c6

View file

@ -26,7 +26,7 @@ class WpaSupplicant:
if ifname:
self.set_ifname(ifname, hostname, port)
res = self.get_driver_status()
if int(res['capa.flags'], 0) & 0x20000000:
if 'capa.flags' in res and int(res['capa.flags'], 0) & 0x20000000:
self.p2p_dev_ifname = 'p2p-dev-' + self.ifname
else:
self.p2p_dev_ifname = ifname
@ -135,7 +135,7 @@ class WpaSupplicant:
port = self.get_ctrl_iface_port(ifname)
self.set_ifname(ifname, self.hostname, port)
res = self.get_driver_status()
if int(res['capa.flags'], 0) & 0x20000000:
if 'capa.flags' in res and int(res['capa.flags'], 0) & 0x20000000:
self.p2p_dev_ifname = 'p2p-dev-' + self.ifname
else:
self.p2p_dev_ifname = ifname