From 7457c635383eb5da7c7afb6cc027b92d059e8e67 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 8 Dec 2014 17:56:47 +0200 Subject: [PATCH] tests: Additional P2P_FIND parameter coverage Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_discovery.py | 7 ++++++- tests/hwsim/wpasupplicant.py | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py index 2071e2427..dc2db2056 100644 --- a/tests/hwsim/test_p2p_discovery.py +++ b/tests/hwsim/test_p2p_discovery.py @@ -16,7 +16,7 @@ def test_discovery(dev): addr0 = dev[0].p2p_dev_addr() addr1 = dev[1].p2p_dev_addr() logger.info("Start device discovery") - dev[0].p2p_find(social=True) + dev[0].p2p_find(social=True, delay=1) if not dev[1].discover_peer(addr0): raise Exception("Device discovery timed out") if not dev[0].discover_peer(addr1): @@ -75,6 +75,11 @@ def test_discovery(dev): dev[0].p2p_stop_find dev[1].p2p_stop_find + if "FAIL" not in dev[0].p2p_find(dev_id="foo"): + raise Exception("P2P_FIND with invalid dev_id accepted") + if "FAIL" not in dev[0].p2p_find(dev_type="foo"): + raise Exception("P2P_FIND with invalid dev_type accepted") + def test_discovery_pd_retries(dev): """P2P device discovery and provision discovery retries""" addr0 = dev[0].p2p_dev_addr() diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 2d7b7f354..a3f9d9d38 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -370,7 +370,8 @@ class WpaSupplicant: def p2p_listen(self): return self.global_request("P2P_LISTEN") - def p2p_find(self, social=False, progressive=False, dev_id=None, dev_type=None): + def p2p_find(self, social=False, progressive=False, dev_id=None, + dev_type=None, delay=None): cmd = "P2P_FIND" if social: cmd = cmd + " type=social" @@ -380,6 +381,8 @@ class WpaSupplicant: cmd = cmd + " dev_id=" + dev_id if dev_type: cmd = cmd + " dev_type=" + dev_type + if delay: + cmd = cmd + " delay=" + str(delay) return self.global_request(cmd) def p2p_stop_find(self):