tests: Wait for scan to complete on all interfaces in reset()
When WpaSupplicant executes reset() it waits until all the ongoing scans are completed. However, it checks the status of the wlanX interface only. If a dedicated P2P device interface is used, scan may be still running on the P2P Device interface, e.g., due to P2P_FIND. This might affect subsequent tests. Fix this by waiting until the scan is done both on wlanX and P2P Device interfaces. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Reviewed-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
ba53a8a009
commit
53606b105c
1 changed files with 12 additions and 6 deletions
|
@ -138,8 +138,11 @@ class WpaSupplicant:
|
||||||
|
|
||||||
iter = 0
|
iter = 0
|
||||||
while iter < 60:
|
while iter < 60:
|
||||||
state = self.get_driver_status_field("scan_state")
|
state1 = self.get_driver_status_field("scan_state")
|
||||||
if "SCAN_STARTED" in state or "SCAN_REQUESTED" in state:
|
p2pdev = "p2p-dev-" + self.ifname
|
||||||
|
state2 = self.get_driver_status_field("scan_state", ifname=p2pdev)
|
||||||
|
states = str(state1) + " " + str(state2)
|
||||||
|
if "SCAN_STARTED" in states or "SCAN_REQUESTED" in states:
|
||||||
logger.info(self.ifname + ": Waiting for scan operation to complete before continuing")
|
logger.info(self.ifname + ": Waiting for scan operation to complete before continuing")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
else:
|
else:
|
||||||
|
@ -354,8 +357,11 @@ class WpaSupplicant:
|
||||||
return vals[field]
|
return vals[field]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_driver_status(self):
|
def get_driver_status(self, ifname=None):
|
||||||
res = self.request("STATUS-DRIVER")
|
if ifname is None:
|
||||||
|
res = self.request("STATUS-DRIVER")
|
||||||
|
else:
|
||||||
|
res = self.global_request("IFNAME=%s STATUS-DRIVER" % ifname)
|
||||||
lines = res.splitlines()
|
lines = res.splitlines()
|
||||||
vals = dict()
|
vals = dict()
|
||||||
for l in lines:
|
for l in lines:
|
||||||
|
@ -367,8 +373,8 @@ class WpaSupplicant:
|
||||||
vals[name] = value
|
vals[name] = value
|
||||||
return vals
|
return vals
|
||||||
|
|
||||||
def get_driver_status_field(self, field):
|
def get_driver_status_field(self, field, ifname=None):
|
||||||
vals = self.get_driver_status()
|
vals = self.get_driver_status(ifname)
|
||||||
if field in vals:
|
if field in vals:
|
||||||
return vals[field]
|
return vals[field]
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue