[PATCH 1/3] tests: permit autogo_scan to work with dedicated P2P device removal

Benjamin Berg benjamin at sipsolutions.net
Wed Oct 15 09:09:18 PDT 2025


Hi,

I should have probably clarified. Internally, we are always setting
"support_p2p_device=1" when loading mac80211_hwsim in the hwsim tests.

So we are running into this problem in our CI infrastructure. My hope
is that we can push this upstream to avoid having to carry it as an
internal patch.

Benjamin

On Wed, 2025-10-15 at 17:43 +0200, Benjamin Berg wrote:
> From: Benjamin Berg <benjamin.berg at intel.com>
> 
> With further patches, the dedicated P2P device will be removed when
> p2p_disabled is set. The test will trigger this with the next patch 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 <benjamin.berg at intel.com>
> Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
> ---
>  tests/hwsim/test_p2p_autogo.py | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py
> index 394cefb572..3a5196d9f6 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"])



More information about the Hostap mailing list