From 610cfff5d7ae9cfb5d51f9068351b1a5832cab14 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 23 Dec 2014 16:15:11 +0200 Subject: [PATCH] tests: Make scan_hidden* more robust Clear cfg80211 BSS table more carefully after the scan_hidden* test cases. At least scan_hidden_many could have left behind a hidden SSID entry that could cause problems for following scan_bss_operations test case. Signed-off-by: Jouni Malinen --- tests/hwsim/test_scan.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index 4a4d4f0f7..f7a30bef2 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -245,7 +245,7 @@ def test_scan_bss_operations(dev, apdev): res = dev[0].request("BSS RANGE=ALL MASK=0x1").splitlines() if len(res) != 2: - raise Exception("Unexpected result") + raise Exception("Unexpected result: " + str(res)) res = dev[0].request("BSS FIRST MASK=0x1") if "id=" + id1 not in res: raise Exception("Unexpected result: " + res) @@ -434,8 +434,8 @@ def test_scan_hidden(dev, apdev): if "FAIL" not in dev[0].request("SCAN scan_id=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17"): raise Exception("Too many scan_id values accepted") - hapd.disable() dev[0].request("REMOVE_NETWORK all") + hapd.disable() dev[0].flush_scan_cache(freq=2432) dev[0].flush_scan_cache() @@ -624,12 +624,13 @@ def test_scan_hidden_many(dev, apdev): try: _test_scan_hidden_many(dev, apdev) finally: + dev[0].flush_scan_cache(freq=2432) dev[0].flush_scan_cache() dev[0].request("SCAN_INTERVAL 5") def _test_scan_hidden_many(dev, apdev): - hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-scan-ssid", - "ignore_broadcast_ssid": "1" }) + hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-scan-ssid", + "ignore_broadcast_ssid": "1" }) bssid = apdev[0]['bssid'] dev[0].request("SCAN_INTERVAL 1") @@ -658,3 +659,5 @@ def _test_scan_hidden_many(dev, apdev): dev[0].request("REASSOCIATE") dev[0].wait_connected(timeout=30) + dev[0].request("REMOVE_NETWORK all") + hapd.disable()