diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index 0b302d5049a4..42532ce9cef2 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -1886,3 +1886,18 @@ 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""" + hostapd.add_ap(apdev[0], {"ssid": "test-scan"}) + bssid = apdev[0]['bssid'] + + check_scan(dev[0], "use_id=1", test_busy=True) + + 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) diff --git a/tests/hwsim/test_wmediumd.py b/tests/hwsim/test_wmediumd.py index 0a8810194ccd..abc8c8c4a6ad 100644 --- a/tests/hwsim/test_wmediumd.py +++ b/tests/hwsim/test_wmediumd.py @@ -9,6 +9,7 @@ from utils import HwsimSkip from wpasupplicant import WpaSupplicant from tshark import run_tshark from test_ap_open import _test_ap_open +from test_scan import test_scan_only_one as _test_scan_only_one from test_wpas_mesh import check_mesh_support, check_mesh_group_added from test_wpas_mesh import check_mesh_peer_connected, add_open_mesh_network from test_wpas_mesh import check_mesh_group_removed @@ -462,3 +463,18 @@ def _test_wmediumd_path_rann(dev, apdev): dev[i].mesh_group_remove() check_mesh_group_removed(dev[i]) dev[i].dump_monitor() + +def test_wmediumd_scan_only_one(dev, apdev, params): + """test a simple wmediumd for scanning""" + fd, fn = tempfile.mkstemp() + try: + f = os.fdopen(fd, 'w') + f.write(CFG % (apdev[0]['bssid'], dev[0].own_addr())) + f.close() + p = start_wmediumd(fn, params) + try: + _test_scan_only_one(dev, apdev) + finally: + stop_wmediumd(p, params) + finally: + os.unlink(fn)