From: Jouni Malinen Date: Sat, 12 Apr 2014 16:48:57 +0000 (+0300) Subject: tests: SCAN_INTERVAL setting X-Git-Tag: hostap_2_2~294 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24e330f7e2e86ed43f17f3d727fffaed4066d0a5;p=thirdparty%2Fhostap.git tests: SCAN_INTERVAL setting Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index f11cdbdee..f13218f8e 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -7,6 +7,7 @@ import time import logging logger = logging.getLogger() +import os import subprocess import hostapd @@ -168,3 +169,31 @@ def test_scan_filter(dev, apdev): raise Exception("Unexpected BSS found in scan results") finally: dev[0].request("SET filter_ssids 0") + +def test_scan_int(dev, apdev): + """scan interval configuration""" + try: + if "FAIL" not in dev[0].request("SCAN_INTERVAL -1"): + raise Exception("Accepted invalid scan interval") + if "OK" not in dev[0].request("SCAN_INTERVAL 1"): + raise Exception("Failed to set scan interval") + dev[0].connect("not-used", key_mgmt="NONE", scan_freq="2412", + wait_connect=False) + times = {} + for i in range(0, 3): + logger.info("Waiting for scan to start") + start = os.times()[4] + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"], timeout=5) + if ev is None: + raise Exception("did not start a scan") + stop = os.times()[4] + times[i] = stop - start + logger.info("Waiting for scan to complete") + ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 10) + if ev is None: + raise Exception("did not complete a scan") + print times + if times[0] > 1 or times[1] < 0.5 or times[1] > 1.5 or times[2] < 0.5 or times[2] > 1.5: + raise Exception("Unexpected scan timing: " + str(times)) + finally: + dev[0].request("SCAN_INTERVAL 5")