* [PATCH BlueZ] test: functional: retry pairable when Busy
@ 2026-10-10 22:32 Pauli Virtanen
2026-10-10 23:52 ` [BlueZ] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Pauli Virtanen @ 2026-10-10 22:32 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Pauli Virtanen
bluetoothctl registers an agent on connect, which toggles bondable.
Before it completes, "pairable on" fails with org.bluez.Error.Busy.
Retry "pairable on" until accepted via a pairable_on() helper.
Fixes flaky test_bluetoothctl_pair_bredr / a2dp tests.
Log:
src/agent.c:add_default_agent() Default agent set to :1.2 /org/bluez/agent
src/adapter.c:set_mode() sending set mode command for index 0
src/agent.c:agent_ref() 0x7c1fb6700110: ref=1
src/agent.c:register_agent() agent :1.2
[:1.2:method_return] < [#22]
[:1.2:method_call] > org.freedesktop.DBus.Properties.Set [#31]
[:1.2:error] < org.bluez.Error.Busy [#31]
src/shared/mgmt.c:send_request() [0x0000] command 0x0009
src/shared/mgmt.c:can_read_data() [0x0000] command 0x0009 complete: 0x00
src/adapter.c:new_settings_callback() Settings: 0x03fc0ad1
src/adapter.c:settings_changed() Changed settings: 0x00000010
[bluetoothctl]> SupportedUUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[bluetoothctl]> SupportedUUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[bluetoothctl]> Agent registered
[bluetoothctl]> Failed to set pairable on: org.bluez.Error.Busy
Assisted-by: opencode:qwen3.8-flash-next
---
test/functional/test_a2dp.py | 5 +++--
test/functional/test_bluetoothctl.py | 25 +++++++++++++++++++++++--
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/test/functional/test_a2dp.py b/test/functional/test_a2dp.py
index 12348ea05..4cf4eb296 100644
--- a/test/functional/test_a2dp.py
+++ b/test/functional/test_a2dp.py
@@ -9,6 +9,8 @@ import pytest
from pytest_bluezenv import Bluetoothd, Pexpect, find_exe, host_config
from pytest_bluezenv.utils import bluez_src_dir
+from .test_bluetoothctl import pairable_on
+
pytestmark = [pytest.mark.vm]
A2DP_SOURCE_UUID = "0000110a-0000-1000-8000-00805f9b34fb"
@@ -50,8 +52,7 @@ def pair(host0, ctl0, host1, ctl1):
ctl0.send("scan on\n")
ctl0.expect(f"Controller {host0.bdaddr.upper()} Discovering: yes")
- ctl1.send("pairable on\n")
- ctl1.expect("Changing pairable on succeeded")
+ pairable_on(ctl1)
ctl1.send("discoverable on\n")
ctl1.expect(f"Controller {host1.bdaddr.upper()} Discoverable: yes")
diff --git a/test/functional/test_bluetoothctl.py b/test/functional/test_bluetoothctl.py
index e8c813a7a..1486d9e99 100644
--- a/test/functional/test_bluetoothctl.py
+++ b/test/functional/test_bluetoothctl.py
@@ -20,6 +20,28 @@ from pytest_bluezenv import host_config, find_exe, run, Bluetoothd, Bluetoothctl
pytestmark = [pytest.mark.vm]
+def pairable_on(ctl):
+ """pairable on for given Bluetoothctl/Pexpect
+
+ Allow failure with org.bluez.Error.Busy, which can occur due to
+ bluetoothctl toggling bondable on startup. Retry until accepted.
+ """
+ while True:
+ ctl.send("pairable on\n")
+ idx, groups = ctl.expect(
+ [
+ "Changing pairable on succeeded",
+ r"Failed to set pairable on: (\S+)\r?\n",
+ ]
+ )
+ if idx == 0:
+ return
+
+ error = groups[0].decode()
+ if error != "org.bluez.Error.Busy":
+ raise AssertionError(f"Failed to set pairable on: {error}")
+
+
@pytest.fixture
def bluetoothctl():
try:
@@ -41,8 +63,7 @@ def test_bluetoothctl_pair_bredr(hosts):
host0.bluetoothctl.send("scan on\n")
host0.bluetoothctl.expect(f"Controller {host0.bdaddr.upper()} Discovering: yes")
- host1.bluetoothctl.send("pairable on\n")
- host1.bluetoothctl.expect("Changing pairable on succeeded")
+ pairable_on(host1.bluetoothctl)
host1.bluetoothctl.send("discoverable on\n")
host1.bluetoothctl.expect(f"Controller {host1.bdaddr.upper()} Discoverable: yes")
--
2.56.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [BlueZ] test: functional: retry pairable when Busy
2026-10-10 22:32 [PATCH BlueZ] test: functional: retry pairable when Busy Pauli Virtanen
@ 2026-10-10 23:52 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-10-10 23:52 UTC (permalink / raw)
To: linux-bluetooth, pav
[-- Attachment #1: Type: text/plain, Size: 2541 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/1183123/
---Test result---
Test Summary:
CheckPatch PASS 0.43 seconds
GitLint FAIL 0.33 seconds
BuildEll PASS 19.45 seconds
BluezMake PASS 395.99 seconds
MakeCheck PASS 14.27 seconds
MakeDistcheck PASS 140.10 seconds
CheckValgrind PASS 231.14 seconds
CheckSmatch PASS 291.30 seconds
bluezmakeextell PASS 94.29 seconds
TestFunctional FAIL 1192.23 seconds
IncrementalBuild PASS 388.67 seconds
ScanBuild PASS 1125.24 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ] test: functional: retry pairable when Busy
22: B3 Line contains hard tab characters (\t): "[bluetoothctl]> SupportedUUIDs: 0000110a-0000-1000-8000-00805f9b34fb"
23: B3 Line contains hard tab characters (\t): "[bluetoothctl]> SupportedUUIDs: 0000110b-0000-1000-8000-00805f9b34fb"
##############################
Test: TestFunctional - FAIL
Desc: Run test-functional
Output:
FAIL functional.test_bearer::test_bearer_le_connect[hosts14-vm2]: pytest_bluezenv.rpc.RemoteError: Got event.kind='org.bluez.Agent1.RequestAuthorization', expected kinds=('org.bluez.Adapter1.StartDiscovery:reply',)
Remote traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.14/dist-packages/pytest_bluezenv/../pytest_bluezenv/rpc.py", line 102, in server_stream
result = method(*msg["a"], **msg["kw"])
File "/usr/local/lib/python3.14/dist-packages/pytest_bluezenv/../pytest_bluezenv/env.py", line 256, in call_plugin
return getattr(self.plugins[name], method)(*a, **kw)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/usr/local/lib/python3.14/dist-packages/pytest_bluezenv/../pytest_bluezenv/agent.py", line 108, in expect
raise AssertionError(f"Got {event.kind=}, expected {kinds=}")
AssertionError: Got event.kind='org.bluez.Agent1.RequestAuthorization', expected kinds=('org.bluez.Adapter1.StartDiscovery:reply',)
https://github.com/bluez/bluez/pull/2659
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-10 23:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-10 22:32 [PATCH BlueZ] test: functional: retry pairable when Busy Pauli Virtanen
2026-10-10 23:52 ` [BlueZ] " bluez.test.bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.