From cc02fd3effe2b8caaabc0ca8ea36932858275917 Mon Sep 17 00:00:00 2001
From: Jouni Malinen <j@w1.fi>
Date: Sun, 6 Dec 2015 20:31:18 +0200
Subject: [PATCH] tests: Make pmksa_cache_opportunistic_connect more robust

This test case could fail if the cfg80211 scan cache brought in a BSS
entry from an earlier test case and a new scan did not get executed
prior to the ROAM command. Fix this by forcing the scan to go through
prior to roaming to AP2

This issue showed up with the following test case sequence:
connect_cmd_roam pmksa_cache_opportunistic_connect

Signed-off-by: Jouni Malinen <j@w1.fi>
---
 tests/hwsim/test_pmksa_cache.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/hwsim/test_pmksa_cache.py b/tests/hwsim/test_pmksa_cache.py
index 77cf25bbf..e51ca9198 100644
--- a/tests/hwsim/test_pmksa_cache.py
+++ b/tests/hwsim/test_pmksa_cache.py
@@ -249,7 +249,7 @@ def test_pmksa_cache_opportunistic_connect(dev, apdev):
 
     wpas.dump_monitor()
     logger.info("Roam to AP2")
-    wpas.scan_for_bss(bssid2, freq="2412")
+    wpas.scan_for_bss(bssid2, freq="2412", force_scan=True)
     wpas.request("ROAM " + bssid2)
     ev = wpas.wait_event(["CTRL-EVENT-EAP-STARTED",
                             "CTRL-EVENT-CONNECTED"], timeout=10)