[PATCH 6/9] tests: Handle different delays in discovery_and_interface_disabled

Ilan Peer ilan.peer at intel.com
Mon Feb 29 04:30:02 PST 2016


Test different delay intervals between the INTERFACE_DISABLED event
and the INTERFACE_ENABLED event for discovery_and_interface_disabled.

Previously, only a delay of 1 second was used, in which case the
scan results for the P2P_FIND operation were received after the
interface was enabled again, and the case the scan results were
received while the interface was disabled was not covered.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/test_p2p_discovery.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py
index 23b18d2..52592d2 100644
--- a/tests/hwsim/test_p2p_discovery.py
+++ b/tests/hwsim/test_p2p_discovery.py
@@ -319,7 +319,7 @@ def test_discovery_social_plus_one(dev):
     if dev[1].peer_known(go):
         raise Exception("GO found in social-only scan")
 
-def test_discovery_and_interface_disabled(dev):
+def _test_discovery_and_interface_disabled(dev, delay=1):
     """P2P device discovery with interface getting didabled"""
     try:
         if "OK" not in dev[0].p2p_find():
@@ -328,7 +328,7 @@ def test_discovery_and_interface_disabled(dev):
         if ev is None:
             raise Exception("Scan did not start")
         dev[0].request("DRIVER_EVENT INTERFACE_DISABLED")
-        time.sleep(1)
+        time.sleep(delay)
 
         # verify that P2P_FIND is rejected
         if "FAIL" not in dev[0].p2p_find():
@@ -347,6 +347,11 @@ def test_discovery_and_interface_disabled(dev):
     finally:
         dev[0].request("DRIVER_EVENT INTERFACE_ENABLED")
 
+def test_discovery_and_interface_disabled(dev):
+    """P2P device discovery with interface getting didabled"""
+    _test_discovery_and_interface_disabled(dev, delay=1)
+    _test_discovery_and_interface_disabled(dev, delay=5)
+
 def test_discovery_auto(dev):
     """P2P device discovery and provision discovery with auto GO/dev selection"""
     dev[0].flush_scan_cache()
-- 
1.9.1




More information about the Hostap mailing list