Browse Source

tests: Add option for running test cases that take a long time

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>
Jouni Malinen 11 years ago
parent
commit
91f3cf6996
2 changed files with 19 additions and 0 deletions
  1. 3 0
      tests/hwsim/run-tests.py
  2. 16 0
      tests/hwsim/test_ap_wps.py

+ 3 - 0
tests/hwsim/run-tests.py

@@ -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)

+ 16 - 0
tests/hwsim/test_ap_wps.py

@@ -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"