]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Merge grpform_cred_ready_timeout test cases into a single one
authorJouni Malinen <j@w1.fi>
Mon, 22 Dec 2014 13:53:12 +0000 (15:53 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 22 Dec 2014 13:54:30 +0000 (15:54 +0200)
These test cases had a long 120 seconds wait for the GO Negotiation
initiator to time out. This can be done using two devices in parallel to
save two minutes from total test execution time.

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

index 222e356d7fe1c0c9d01cee7e0be9b1ec39710863..152814242b4e54813a5664ed00f027a0b14675b0 100644 (file)
@@ -14,6 +14,7 @@ import os
 import hostapd
 import hwsim_utils
 import utils
+from wpasupplicant import WpaSupplicant
 
 def check_grpform_results(i_res, r_res):
     if i_res['result'] != 'success' or r_res['result'] != 'success':
@@ -734,52 +735,55 @@ def test_grpform_cred_ready_timeout(dev, apdev, params):
     addr1 = dev[1].p2p_dev_addr()
     if not dev[0].discover_peer(addr1):
         raise Exception("Peer " + addr1 + " not found")
+    if not dev[2].discover_peer(addr1):
+        raise Exception("Peer " + addr1 + " not found(2)")
+
     start = os.times()[4]
-    if "OK" not in dev[0].request("P2P_CONNECT " + addr1 + " 12345670 display"):
+
+    cmd = "P2P_CONNECT " + addr1 + " 12345670 display"
+    if "OK" not in dev[0].global_request(cmd):
         raise Exception("Failed to initiate GO Neg")
-    ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=200)
+
+    if "OK" not in dev[2].global_request(cmd):
+        raise Exception("Failed to initiate GO Neg(2)")
+
+    # First, check with p2p_find
+    ev = dev[2].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=30)
+    if ev is not None:
+        raise Exception("Too early GO Negotiation timeout reported(2)")
+    dev[2].dump_monitor()
+    logger.info("Starting p2p_find to change state")
+    dev[2].p2p_find()
+    ev = dev[2].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=100)
     if ev is None:
-        raise Exception("GO Negotiation failure timed out")
+        raise Exception("GO Negotiation failure timed out(2)")
+    dev[2].dump_monitor()
     end = os.times()[4]
-    logger.info("GO Negotiation wait time: {} seconds".format(end - start))
+    logger.info("GO Negotiation wait time: {} seconds(2)".format(end - start))
     if end - start < 120:
-        raise Exception("Too short GO Negotiation wait time: {}".format(end - start))
+        raise Exception("Too short GO Negotiation wait time(2): {}".format(end - start))
 
-def test_grpform_cred_ready_timeout2(dev, apdev, params):
-    """P2P GO Negotiation wait for credentials to become ready (2) [long]"""
-    if not params['long']:
-        logger.info("Skip test case with long duration due to --long not specified")
-        return "skip"
+    wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+    wpas.interface_add("wlan5")
 
-    dev[1].p2p_listen()
-    addr1 = dev[1].p2p_dev_addr()
-    if not dev[0].discover_peer(addr1):
-        raise Exception("Peer " + addr1 + " not found")
-    start = os.times()[4]
-    if "OK" not in dev[0].global_request("P2P_CONNECT " + addr1 + " 12345670 display"):
-        raise Exception("Failed to initiate GO Neg")
-    ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=30)
-    if ev is not None:
-        raise Exception("Too early GO Negotiation timeout reported")
-    dev[0].dump_monitor()
-    logger.info("Starting p2p_find to change state")
-    dev[0].p2p_find()
-    ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=100)
+    wpas.p2p_listen()
+    ev = dev[2].wait_global_event(["P2P-DEVICE-FOUND"], timeout=10)
+    if ev is None:
+        raise Exception("Did not discover new device after GO Negotiation failure")
+    if wpas.p2p_dev_addr() not in ev:
+        raise Exception("Unexpected device found: " + ev)
+    dev[2].p2p_stop_find()
+    wpas.p2p_stop_find()
+
+    # Finally, verify without p2p_find
+    ev = dev[0].wait_global_event(["P2P-GO-NEG-FAILURE"], timeout=120)
     if ev is None:
         raise Exception("GO Negotiation failure timed out")
-    dev[0].dump_monitor()
     end = os.times()[4]
     logger.info("GO Negotiation wait time: {} seconds".format(end - start))
     if end - start < 120:
         raise Exception("Too short GO Negotiation wait time: {}".format(end - start))
 
-    dev[2].p2p_listen()
-    ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=10)
-    if ev is None:
-        raise Exception("Did not discovery new device after GO Negotiation failure")
-    if dev[2].p2p_dev_addr() not in ev:
-        raise Exception("Unexpected device found: " + ev)
-
 def test_grpform_no_wsc_done(dev):
     """P2P group formation with WSC-Done not sent"""
     addr0 = dev[0].p2p_dev_addr()
index 4ab2eede6da5af400bc4e453d8805608168ff5bb..c7a8d9b61611d636d51bea79ebc028997d74cc7f 100755 (executable)
@@ -172,7 +172,6 @@ def main():
         # completed their work.
         long = [ "ap_wps_pbc_timeout",
                  "grpform_cred_ready_timeout",
-                 "grpform_cred_ready_timeout2",
                  "discovery_pd_retries",
                  "ibss_wpa_none",
                  "concurrent_p2pcli",