]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Make ap_anqp_sharing more robust
authorJouni Malinen <j@w1.fi>
Sat, 17 Jan 2015 16:19:45 +0000 (18:19 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 18 Jan 2015 10:50:20 +0000 (12:50 +0200)
This test case uses get_bss() with a BSSID to find a BSS entry. That can
result in failures if there are multiple BSS entries in wpa_supplicant
BSS table for the same BSSID, e.g., due to an earlier hidden SSID test
case. Explicitly clear the cfg80211 and wpa_supplicant scan caches at
the beginning of this test case to make it less likely for earlier test
cases to trigger a failure here.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_hs20.py

index 58db956c9f2bb24ac4213432b53f8d2466d8d159..617b4fad3771cadb7c048b21078cc243baa20297 100644 (file)
@@ -159,6 +159,8 @@ def check_probe_resp(wt, bssid_unexpected, bssid_expected):
 
 def test_ap_anqp_sharing(dev, apdev):
     """ANQP sharing within ESS and explicit unshare"""
+    dev[0].flush_scan_cache()
+
     bssid = apdev[0]['bssid']
     params = hs20_ap_params()
     params['hessid'] = bssid
@@ -180,8 +182,13 @@ def test_ap_anqp_sharing(dev, apdev):
     interworking_select(dev[0], None, "home", freq="2412")
     dev[0].dump_monitor()
 
+    logger.debug("BSS entries:\n" + dev[0].request("BSS RANGE=ALL"))
     res1 = dev[0].get_bss(bssid)
     res2 = dev[0].get_bss(bssid2)
+    if 'anqp_nai_realm' not in res1:
+        raise Exception("anqp_nai_realm not found for AP1")
+    if 'anqp_nai_realm' not in res2:
+        raise Exception("anqp_nai_realm not found for AP2")
     if res1['anqp_nai_realm'] != res2['anqp_nai_realm']:
         raise Exception("ANQP results were not shared between BSSes")