* [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
2026-10-14 17:20 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ 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] 3+ 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
2026-10-14 17:20 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ 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] 3+ messages in thread
* Re: [PATCH 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,v1] " bluez.test.bot
@ 2026-10-14 17:20 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-14 17:20 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 13 Oct 2026 11:03:36 -0400 you wrote:
> 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:
>
> [...]
Here is the summary with links:
- [BlueZ,v1] test: functional: connect instead of pairing a bonded BAP device
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0a48b5ef5e3d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-14 17:20 UTC | newest]
Thread overview: 3+ 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
2026-10-14 17:20 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox