From: Benjamin Berg Date: Wed, 15 Oct 2025 15:43:59 +0000 (+0200) Subject: tests: Permit autogo_scan to work with dedicated P2P device removal X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68634e48932d0787337521575f0b042449fa339d;p=thirdparty%2Fhostap.git tests: Permit autogo_scan to work with dedicated P2P device removal The next commit will end up removing the dedicated P2P device when p2p_disabled is set. The test will trigger this when support_p2p_device=1 is used and that would lead to a test failure as the device is not configured correctly and may have changed its address. Fix this by repeating the setup after the dedicated P2P device has been recreated. Signed-off-by: Benjamin Berg Reviewed-by: Andrei Otcheretianski --- diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py index 394cefb57..3a5196d9f 100644 --- a/tests/hwsim/test_p2p_autogo.py +++ b/tests/hwsim/test_p2p_autogo.py @@ -818,7 +818,6 @@ def rx_pd_req(dev): def test_autogo_scan(dev): """P2P autonomous GO and no P2P IE in Probe Response scan results""" addr0 = dev[0].p2p_dev_addr() - addr1 = dev[1].p2p_dev_addr() dev[0].p2p_start_go(freq=2412, persistent=True) bssid = dev[0].p2p_interface_addr() @@ -828,9 +827,6 @@ def test_autogo_scan(dev): time.sleep(0.1) dev[1].flush_scan_cache() - pin = dev[1].wps_read_pin() - dev[0].group_request("WPS_PIN any " + pin) - try: dev[1].request("SET p2p_disabled 1") dev[1].request("SCAN freq=2412") @@ -840,6 +836,17 @@ def test_autogo_scan(dev): finally: dev[1].request("SET p2p_disabled 0") + # When dev[1] has a dedicated P2P Device interface, then p2p_disabled + # will remove it. So get the address now and repeat some of the setup. + addr1 = dev[1].p2p_dev_addr() + pin = dev[1].wps_read_pin() + dev[0].group_request("WPS_PIN any " + pin) + dev[1].discover_peer(addr0) + dev[1].p2p_stop_find() + ev = dev[1].wait_global_event(["P2P-FIND-STOPPED"], timeout=2) + time.sleep(0.1) + dev[1].flush_scan_cache() + for i in range(2): dev[1].request("SCAN freq=2412 passive=1") ev = dev[1].wait_event(["CTRL-EVENT-SCAN-RESULTS"])