From 57de28b94a81a8ad16aba8ca23e45b5265a44d9b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 28 Mar 2021 18:05:47 +0300 Subject: [PATCH] tests: WPS ER and HTTP client timeout Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_wps.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index 08be5f41f..2120e503e 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/tests/hwsim/test_ap_wps.py @@ -4358,10 +4358,12 @@ def wps_er_stop(dev, sock, server, on_alloc_fail=False): raise Exception("No WPS-ER-AP-REMOVE event on max-age timeout") dev.request("WPS_ER_STOP") -def run_wps_er_proto_test(dev, handler, no_event_url=False, location_url=None): +def run_wps_er_proto_test(dev, handler, no_event_url=False, location_url=None, + max_age=1): try: uuid = '27ea801a-9e5c-4e73-bd82-f89cbcd10d7e' - server, sock = wps_er_start(dev, handler, location_url=location_url) + server, sock = wps_er_start(dev, handler, location_url=location_url, + max_age=max_age) global wps_event_url wps_event_url = None server.handle_request() @@ -5105,6 +5107,15 @@ def test_ap_wps_er_http_client(dev, apdev): run_wps_er_proto_test(dev[0], WPSAPHTTPServer_req_as_resp, no_event_url=True) +def test_ap_wps_er_http_client_timeout(dev, apdev): + """WPS ER and HTTP client timeout""" + class WPSAPHTTPServer_timeout(WPSAPHTTPServer): + def handle_upnp_info(self): + time.sleep(31) + self.wfile.write(b"GET / HTTP/1.1\r\n\r\n") + run_wps_er_proto_test(dev[0], WPSAPHTTPServer_timeout, + no_event_url=True, max_age=60) + def test_ap_wps_init_oom(dev, apdev): """wps_init OOM cases""" ssid = "test-wps"