tests: Verify behavior during externally triggered scan
Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
6428d0a71f
commit
e766f56643
1 changed files with 24 additions and 2 deletions
|
@ -9,16 +9,31 @@
|
|||
import time
|
||||
import logging
|
||||
logger = logging.getLogger()
|
||||
import subprocess
|
||||
|
||||
import hostapd
|
||||
|
||||
def check_scan(dev, params):
|
||||
def check_scan(dev, params, other_started=False):
|
||||
if not other_started:
|
||||
dev.dump_monitor()
|
||||
id = dev.request("SCAN " + params)
|
||||
if "FAIL" in id:
|
||||
raise Exception("Failed to start scan")
|
||||
id = int(id)
|
||||
|
||||
if other_started:
|
||||
ev = dev.wait_event(["CTRL-EVENT-SCAN-STARTED"])
|
||||
if ev is None:
|
||||
raise Exception("Other scan did not start")
|
||||
if "id=" + str(id) in ev:
|
||||
raise Exception("Own scan id unexpectedly included in start event")
|
||||
|
||||
ev = dev.wait_event(["CTRL-EVENT-SCAN-RESULTS"])
|
||||
if ev is None:
|
||||
raise Exception("Other scan did not complete")
|
||||
if "id=" + str(id) in ev:
|
||||
raise Exception("Own scan id unexpectedly included in completed event")
|
||||
|
||||
ev = dev.wait_event(["CTRL-EVENT-SCAN-STARTED"])
|
||||
if ev is None:
|
||||
raise Exception("Scan did not start")
|
||||
|
@ -86,3 +101,10 @@ def test_scan_only(dev, apdev):
|
|||
check_scan(dev[0], "type=only freq=2412 passive=0 use_id=1")
|
||||
if int(dev[0].get_bss(bssid)['age']) > 1:
|
||||
raise Exception("Unexpectedly old BSS entry")
|
||||
|
||||
def test_scan_external_trigger(dev, apdev):
|
||||
"""Avoid operations during externally triggered scan"""
|
||||
hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-scan" })
|
||||
bssid = apdev[0]['bssid']
|
||||
subprocess.call(['sudo', 'iw', dev[0].ifname, 'scan', 'trigger'])
|
||||
check_scan(dev[0], "use_id=1", other_started=True)
|
||||
|
|
Loading…
Reference in a new issue