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):