]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Add option for running test cases that take a long time
authorJouni Malinen <j@w1.fi>
Sun, 6 Apr 2014 10:11:32 +0000 (13:11 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 6 Apr 2014 10:11:32 +0000 (13:11 +0300)
run-tests.py now takes an optional --long parameter that can be used to
enable running of test cases that take a long time (multiple minutes).
By default, such test cases are skipped to avoid making the normal test
run take excessive amounts of time.

As an initial long test case, verify WPS PBC walk time expiration (two
minutes).

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/run-tests.py
tests/hwsim/test_ap_wps.py

index 7afe108de1e5be2250d385b77aaa09bce292607b..6e490e094fd1e1b476e3d37d963e7fb09609d9f6 100755 (executable)
@@ -187,6 +187,8 @@ def main():
     parser.add_argument('--split', help='split tests for parallel execution (<server number>/<total servers>)')
     parser.add_argument('--no-reset', action='store_true', dest='no_reset',
                         help='Do not reset devices at the end of the test')
+    parser.add_argument('--long', action='store_true',
+                        help='Include test cases that take long time')
     parser.add_argument('-f', dest='testmodules', metavar='<test module>',
                         help='execute only tests from these test modules',
                         type=str, choices=[[]] + test_modules, nargs='+')
@@ -353,6 +355,7 @@ def main():
                 if t.func_code.co_argcount > 2:
                     params = {}
                     params['logdir'] = args.logdir
+                    params['long'] = args.long
                     res = t(dev, apdev, params)
                 elif t.func_code.co_argcount > 1:
                     res = t(dev, apdev)
index 57467106b98fa0357f6db947ba2d859c1c4b6370..04988b312c071009a4d75121270f9e199707b0c7 100644 (file)
@@ -1343,6 +1343,22 @@ def test_ap_wps_auto_setup_with_config_file(dev, apdev):
     finally:
         subprocess.call(['sudo', 'rm', conffile])
 
+def test_ap_wps_pbc_timeout(dev, apdev, params):
+    """wpa_supplicant PBC walk time [long]"""
+    if not params['long']:
+        logger.info("Skip test case with long duration due to --long not specified")
+        return "skip"
+    ssid = "test-wps"
+    hostapd.add_ap(apdev[0]['ifname'],
+                   { "ssid": ssid, "eap_server": "1", "wps_state": "1" })
+    hapd = hostapd.Hostapd(apdev[0]['ifname'])
+    logger.info("Start WPS_PBC and wait for PBC walk time expiration")
+    if "OK" not in dev[0].request("WPS_PBC"):
+        raise Exception("WPS_PBC failed")
+    ev = dev[0].wait_event(["WPS-TIMEOUT"], timeout=150)
+    if ev is None:
+        raise Exception("WPS-TIMEOUT not reported")
+
 def add_ssdp_ap(ifname, ap_uuid):
     ssid = "wps-ssdp"
     ap_pin = "12345670"