diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py index 315b2cc9b..6f6f65a5c 100644 --- a/tests/hwsim/test_ap_tdls.py +++ b/tests/hwsim/test_ap_tdls.py @@ -363,12 +363,16 @@ def tdls_clear_reg(hapd, dev): if hapd: hapd.request("DISABLE") dev[0].request("DISCONNECT") - dev[0].request("ABORT_SCAN") + res0 = dev[0].request("ABORT_SCAN") dev[1].request("DISCONNECT") - dev[1].request("ABORT_SCAN") - dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5) + res1 = dev[1].request("ABORT_SCAN") + for i in range(2 if "OK" in res0 else 1): + dev[0].wait_event(["CTRL-EVENT-DISCONNECTED", + "CTRL-EVENT-SCAN-RESULTS"], timeout=0.5) dev[0].dump_monitor() - dev[1].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5) + for i in range(2 if "OK" in res1 else 1): + dev[1].wait_event(["CTRL-EVENT-DISCONNECTED", + "CTRL-EVENT-SCAN-RESULTS"], timeout=0.5) dev[1].dump_monitor() subprocess.call(['iw', 'reg', 'set', '00']) dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 8a253c7a6..b447ba6a8 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -1062,8 +1062,9 @@ class WpaSupplicant: cmd += " passive=1" if not no_wait: self.dump_monitor() - if not "OK" in self.request(cmd): - raise Exception("Failed to trigger scan") + res = self.request(cmd) + if not "OK" in res: + raise Exception("Failed to trigger scan: " + str(res)) if no_wait: return ev = self.wait_event(["CTRL-EVENT-SCAN-RESULTS", @@ -1089,6 +1090,7 @@ class WpaSupplicant: self.scan(freq=freq, only_new=True) res = self.request("SCAN_RESULTS") if len(res.splitlines()) > 1: + logger.debug("Scan results remaining after first attempt to flush the results:\n" + res) self.request("BSS_FLUSH 0") self.scan(freq=2422, only_new=True) res = self.request("SCAN_RESULTS")