tests: Add negative scan tests

There was a bug in wmediumd in that it didn't set the
frequency of frames, and thus they were always received
by mac80211_hwsim, regardless of channel it was on.

Add two tests that verify we only find a single instance
of an AP if we only have that one, and run this both with
and without wmediumd.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2019-10-08 14:11:09 +02:00 committed by Jouni Malinen
parent f11157604c
commit dcafde0c32
2 changed files with 36 additions and 0 deletions

View file

@ -1886,3 +1886,20 @@ def test_connect_mbssid_open_1(dev, apdev):
# able to start connection attempt.
dev[0].request("REMOVE_NETWORK all")
dev[0].dump_monitor()
def test_scan_only_one(dev, apdev):
"""Test that scanning with a single active AP only returns that one"""
dev[0].flush_scan_cache()
hostapd.add_ap(apdev[0], {"ssid": "test-scan"})
bssid = apdev[0]['bssid']
check_scan(dev[0], "use_id=1", test_busy=True)
dev[0].scan_for_bss(bssid, freq="2412")
status, stdout = hostapd.cmd_execute(dev[0], ['iw', dev[0].ifname, 'scan', 'dump'])
if status != 0:
raise Exception("iw scan dump failed with code %d" % status)
lines = stdout.split('\n')
entries = len(list(filter(lambda x: x.startswith('BSS '), lines)))
if entries != 1:
raise Exception("expected to find 1 BSS entry, got %d" % entries)