]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix ap_wpa2_eap_status loop with UML time-travel=inf-cpu
authorJouni Malinen <j@w1.fi>
Mon, 27 May 2019 19:22:07 +0000 (22:22 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 27 May 2019 19:43:07 +0000 (22:43 +0300)
Busy loop for waiting is not going to work with time-travel=inf-cpu, so
need to something a bit more explicit to wait for the wpa_supplicant
process to proceed while not fully breaking the idea of this test case
to iteration through large number of STATUS-VERBOSE commands to hit
different states.

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

index 887faf0f5cb90c749038e44787dbd799c78a8f11..911baf61e698c756beb403aec41881e692d55060 100644 (file)
@@ -6545,7 +6545,12 @@ def test_ap_wpa2_eap_status(dev, apdev):
     decisions = []
     req_methods = []
     selected_methods = []
+    connected = False
     for i in range(100000):
+        if not connected and i % 10 == 9:
+            ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=0.0001)
+            if ev:
+                connected = True
         s = dev[0].get_status(extra="VERBOSE")
         if 'EAP state' in s:
             state = s['EAP state']
@@ -6579,7 +6584,8 @@ def test_ap_wpa2_eap_status(dev, apdev):
     logger.info("selectedMethods: " + str(selected_methods))
     if not success:
         raise Exception("EAP did not succeed")
-    dev[0].wait_connected()
+    if not connected:
+        dev[0].wait_connected()
     dev[0].request("REMOVE_NETWORK all")
     dev[0].wait_disconnected()