aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-01-04 08:35:01 (GMT)
committerJouni Malinen <j@w1.fi>2014-01-07 08:45:10 (GMT)
commite766f56643f91cc1071d5a5ed43582cb404ec5a8 (patch)
tree69eae844c1220f992882993ad8cb2330ad745024
parent6428d0a71f1d6bf5542930eaa1b0512830646c5f (diff)
downloadhostap-e766f56643f91cc1071d5a5ed43582cb404ec5a8.zip
hostap-e766f56643f91cc1071d5a5ed43582cb404ec5a8.tar.gz
hostap-e766f56643f91cc1071d5a5ed43582cb404ec5a8.tar.bz2
tests: Verify behavior during externally triggered scan
Signed-hostap: Jouni Malinen <j@w1.fi>
-rw-r--r--tests/hwsim/test_scan.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py
index ebc62b6..938abda 100644
--- a/tests/hwsim/test_scan.py
+++ b/tests/hwsim/test_scan.py
@@ -9,16 +9,31 @@
import time
import logging
logger = logging.getLogger()
+import subprocess
import hostapd
-def check_scan(dev, params):
- dev.dump_monitor()
+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)