Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] test: functional: connect instead of pairing a bonded BAP device
@ 2026-10-13 15:03 Luiz Augusto von Dentz
  2026-10-13 19:29 ` [BlueZ,v1] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2026-10-13 15:03 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The hosts are shared between tests, so a device bonded by an earlier one
is still bonded when a later one pairs it, and pairing it again fails
with AlreadyExists. cmd_pair is meant to connect it instead, but it
checks Paired, which is not set until the services are resolved, so it
can still issue the pairing:

  FAILED test/functional/test_bap.py::test_bass_past_transport_acquire
  AssertionError: Failed to pair: org.bluez.Error.AlreadyExists

Check Bonded, which is what the pairing is rejected for, and connect the
device instead when it is set.

Assisted-by: OpenCode:claude-opus-5.5
---
 test/functional/test_bap.py | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/test/functional/test_bap.py b/test/functional/test_bap.py
index c4bd5fc6aa61..7cd9466bd5f7 100644
--- a/test/functional/test_bap.py
+++ b/test/functional/test_bap.py
@@ -112,12 +112,20 @@ def pair_le(host0, ctl0, host1, ctl1, advertise=True, services=False):
         ctl1.send("advertise on\n")
         ctl1.expect("Advertising object registered")
 
-    ctl0.expect(f"Device {host1.bdaddr.upper()}")
-    ctl0.send(f"pair {host1.bdaddr.upper()}\n")
+    addr = host1.bdaddr.upper()
+
+    ctl0.expect(f"Device {addr}")
+
+    # A device bonded by an earlier test on the same hosts is rejected
+    # with AlreadyExists if paired again, so connect it instead
+    if is_bonded(ctl0, addr):
+        ctl0.send(f"connect {addr}\n")
+    else:
+        ctl0.send(f"pair {addr}\n")
 
     pending = [PAIRED]
     if services:
-        pending.append(f"Device {host1.bdaddr.upper()} ServicesResolved: yes")
+        pending.append(f"Device {addr} ServicesResolved: yes")
 
     pair_wait(ctl0, ctl1, pending)
 
@@ -155,6 +163,25 @@ def list_transports(ctl0, hosts):
         transports[idx - 1] = m[0].decode("utf-8")
 
 
+def is_bonded(ctl0, addr):
+    """
+    Tell whether the given device is bonded already.
+
+    This is what pairing it is rejected for, which Paired does not
+    reflect until the services are resolved, so cmd_pair, which checks
+    Paired, can still end up pairing a bonded device.
+    """
+    ctl0.send(f"info {addr}\n")
+
+    # Tab indented: the [CHG] lines and the LE. and BREDR. ones are not
+    idx, m = ctl0.expect(
+        [r"\tBonded: (yes|no)", rf"Device {addr} not available"],
+        timeout=REPLY_TIMEOUT,
+    )
+
+    return idx == 0 and m[0] == b"yes"
+
+
 def remove_device(ctl0, host):
     """
     Remove the given host, so the test starts from a state where it is
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [BlueZ,v1] test: functional: connect instead of pairing a bonded BAP device
  2026-10-13 15:03 [PATCH BlueZ v1] test: functional: connect instead of pairing a bonded BAP device Luiz Augusto von Dentz
@ 2026-10-13 19:29 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-10-13 19:29 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1184865/

---Test result---

Test Summary:
CheckPatch                    PASS      0.30 seconds
GitLint                       PASS      0.24 seconds
BuildEll                      PASS      17.55 seconds
BluezMake                     PASS      272.61 seconds
MakeCheck                     PASS      13.65 seconds
MakeDistcheck                 PASS      131.54 seconds
CheckValgrind                 PASS      225.56 seconds
CheckSmatch                   PASS      246.14 seconds
bluezmakeextell               PASS      88.43 seconds
TestFunctional                PASS      1035.10 seconds
IncrementalBuild              PASS      265.87 seconds
ScanBuild                     PASS      988.13 seconds



https://github.com/bluez/bluez/pull/2673

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-13 19:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 15:03 [PATCH BlueZ v1] test: functional: connect instead of pairing a bonded BAP device Luiz Augusto von Dentz
2026-10-13 19:29 ` [BlueZ,v1] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox