Message ID | 1423042236-25252-8-git-send-email-ilan.peer@intel.com |
---|---|
State | Changes Requested |
Headers | show |
On Wed, Feb 04, 2015 at 04:30:19AM -0500, Ilan Peer wrote: > Modify the tests in test_p2p_discovery to use the global > control interface and group interface. > diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py > @@ -132,19 +132,21 @@ def test_discovery_group_client(dev): > # make group client non-responsive on operating channel > dev[1].dump_monitor() > dev[1].group_request("DISCONNECT") > - dev[1].wait_disconnected(timeout=10) > + ev = dev[1].wait_global_event(["CTRL-EVENT-DISCONNECTED"], timeout=10) > + if ev is None: > + raise Exception("Timeout on waiting disconnection") That does not look correct. A group_request to disconnect should get a group event, not global event, CTRL-EVENT-DISCONNECTED. > @@ -234,8 +236,8 @@ def test_discovery_social_plus_one(dev): > - dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"]) > - dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"]) > + dev[0].wait_global_event(["CTRL-EVENT-SCAN-STARTED"], timeout=1) > + dev[0].wait_global_event(["CTRL-EVENT-SCAN-STARTED"], timeout=1) This looks bad, i.e., scan events should not really be global events. The scan started events for p2p_find should actually just be removed completely.
> -----Original Message----- > From: hostap-bounces@lists.shmoo.com [mailto:hostap- > bounces@lists.shmoo.com] On Behalf Of Jouni Malinen > Sent: Thursday, February 05, 2015 13:45 > To: hostap@lists.shmoo.com > Subject: Re: [PATCH 07/24] tests: Modify test_p2p_discovery to use global > and group interfaces > > On Wed, Feb 04, 2015 at 04:30:19AM -0500, Ilan Peer wrote: > > Modify the tests in test_p2p_discovery to use the global control > > interface and group interface. > > > diff --git a/tests/hwsim/test_p2p_discovery.py > > b/tests/hwsim/test_p2p_discovery.py > > @@ -132,19 +132,21 @@ def test_discovery_group_client(dev): > > # make group client non-responsive on operating channel > > dev[1].dump_monitor() > > dev[1].group_request("DISCONNECT") > > - dev[1].wait_disconnected(timeout=10) > > + ev = dev[1].wait_global_event(["CTRL-EVENT-DISCONNECTED"], > timeout=10) > > + if ev is None: > > + raise Exception("Timeout on waiting disconnection") > > That does not look correct. A group_request to disconnect should get a > group event, not global event, CTRL-EVENT-DISCONNECTED. > Fixed. > > @@ -234,8 +236,8 @@ def test_discovery_social_plus_one(dev): > > - dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"]) > > - dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"]) > > + dev[0].wait_global_event(["CTRL-EVENT-SCAN-STARTED"], timeout=1) > > + dev[0].wait_global_event(["CTRL-EVENT-SCAN-STARTED"], timeout=1) > > This looks bad, i.e., scan events should not really be global events. > The scan started events for p2p_find should actually just be removed > completely. > You mean you would like to see the events removed from the wpa_supplicant code? Would you like to see some other events, i.e., P2P_FIND_STARTED/STOPPED + P2P_SEARCH_STARTED/STOPPED etc.? Ilan.
On Fri, Feb 06, 2015 at 07:20:33AM +0000, Peer, Ilan wrote: > > > @@ -234,8 +236,8 @@ def test_discovery_social_plus_one(dev): > > > - dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"]) > > > - dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"]) > > > + dev[0].wait_global_event(["CTRL-EVENT-SCAN-STARTED"], timeout=1) > > > + dev[0].wait_global_event(["CTRL-EVENT-SCAN-STARTED"], timeout=1) > > > > This looks bad, i.e., scan events should not really be global events. > > The scan started events for p2p_find should actually just be removed > > completely. > > You mean you would like to see the events removed from the wpa_supplicant code? Would you like to see some other events, i.e., P2P_FIND_STARTED/STOPPED + P2P_SEARCH_STARTED/STOPPED etc.? Yes, I'm thinking of removing CTRL-EVENT-SCAN-STARTED completely from p2p_find cases and no, I would not replace it with P2P_SEARCH_STARTED. The key point here is that it is of no real use to get that event every 300 ms or so during an ongoing p2p_find operation. The CTRL-EVENT-SCAN-RESULTS was already removed from that case, but the started event needs different handling. Anyway, I think I'll just drop this part of your patch to avoid delaying the other parts getting in.
diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py index 2913267..db05c2a 100644 --- a/tests/hwsim/test_p2p_discovery.py +++ b/tests/hwsim/test_p2p_discovery.py @@ -99,7 +99,7 @@ def test_discovery_pd_retries(dev): dev[1].p2p_stop_find() dev[0].p2p_stop_find() dev[0].global_request("P2P_PROV_DISC " + addr1 + " display") - ev = dev[0].wait_event(["P2P-PROV-DISC-FAILURE"], timeout=60) + ev = dev[0].wait_global_event(["P2P-PROV-DISC-FAILURE"], timeout=60) if ev is None: raise Exception("No PD failure reported") @@ -132,19 +132,21 @@ def test_discovery_group_client(dev): # make group client non-responsive on operating channel dev[1].dump_monitor() dev[1].group_request("DISCONNECT") - dev[1].wait_disconnected(timeout=10) + ev = dev[1].wait_global_event(["CTRL-EVENT-DISCONNECTED"], timeout=10) + if ev is None: + raise Exception("Timeout on waiting disconnection") dev[2].request("P2P_CONNECT {} {} display".format(dev[1].p2p_dev_addr(), pin)) - ev = dev[1].wait_event(["P2P-GO-NEG-REQUEST"], timeout=2) + ev = dev[1].wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=2) if ev: raise Exception("Unexpected frame RX on P2P client") # make group client available on operating channe - dev[1].request("REASSOCIATE") - ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED", "P2P-GO-NEG-REQUEST"]) + dev[1].group_request("REASSOCIATE") + ev = dev[1].wait_global_event(["CTRL-EVENT-CONNECTED", "P2P-GO-NEG-REQUEST"], timeout=10) if ev is None: raise Exception("Timeout on reconnection to group") if "P2P-GO-NEG-REQUEST" not in ev: - ev = dev[1].wait_event(["P2P-GO-NEG-REQUEST"]) + ev = dev[1].wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=10) if ev is None: raise Exception("Timeout on waiting for GO Negotiation Request") @@ -153,11 +155,11 @@ def test_discovery_dev_type(dev): dev[1].request("SET sec_device_type 1-0050F204-2") dev[1].p2p_listen() dev[0].p2p_find(social=True, dev_type="5-0050F204-1") - ev = dev[0].wait_event(['P2P-DEVICE-FOUND'], timeout=1) + ev = dev[0].wait_global_event(['P2P-DEVICE-FOUND'], timeout=1) if ev: raise Exception("Unexpected P2P device found") dev[0].p2p_find(social=True, dev_type="1-0050F204-2") - ev = dev[0].wait_event(['P2P-DEVICE-FOUND'], timeout=2) + ev = dev[0].wait_global_event(['P2P-DEVICE-FOUND'], timeout=2) if ev is None: raise Exception("P2P device not found") peer = dev[0].get_peer(dev[1].p2p_dev_addr()) @@ -174,11 +176,11 @@ def test_discovery_dev_type_go(dev): dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60) dev[2].p2p_find(social=True, dev_type="5-0050F204-1") - ev = dev[2].wait_event(['P2P-DEVICE-FOUND'], timeout=1) + ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND'], timeout=1) if ev: raise Exception("Unexpected P2P device found") dev[2].p2p_find(social=True, dev_type="1-0050F204-2") - ev = dev[2].wait_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2) + ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2) if ev is None: raise Exception("P2P device not found") @@ -220,11 +222,11 @@ def test_discovery_dev_id_go(dev): dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60) dev[2].p2p_find(social=True, dev_id="02:03:04:05:06:07") - ev = dev[2].wait_event(['P2P-DEVICE-FOUND'], timeout=1) + ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND'], timeout=1) if ev: raise Exception("Unexpected P2P device found") dev[2].p2p_find(social=True, dev_id=addr1) - ev = dev[2].wait_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2) + ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2) if ev is None: raise Exception("P2P device not found") @@ -234,8 +236,8 @@ def test_discovery_social_plus_one(dev): dev[1].p2p_find(social=True) dev[0].p2p_find(progressive=True) logger.info("Wait for initial progressive find phases") - dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"]) - dev[0].wait_event(["CTRL-EVENT-SCAN-STARTED"]) + dev[0].wait_global_event(["CTRL-EVENT-SCAN-STARTED"], timeout=1) + dev[0].wait_global_event(["CTRL-EVENT-SCAN-STARTED"], timeout=1) go = dev[2].p2p_dev_addr() dev[2].p2p_start_go(freq="2422") logger.info("Verify whether the GO on non-social channel can be found")
Modify the tests in test_p2p_discovery to use the global control interface and group interface. Signed-off-by: Ilan Peer <ilan.peer@intel.com> --- tests/hwsim/test_p2p_discovery.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)