From: Jouni Malinen Date: Sun, 6 Apr 2014 10:11:32 +0000 (+0300) Subject: tests: Add option for running test cases that take a long time X-Git-Tag: hostap_2_2~368 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=91f3cf6996659374807b153c9260e7e9d06cc739;p=mech_eap.git 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 --- diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index 7afe108..6e490e0 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -187,6 +187,8 @@ def main(): parser.add_argument('--split', help='split tests for parallel execution (/)') 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='', 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) diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index 5746710..04988b3 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/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"