* [PATCH RESEND BlueZ] test: functional: retry pairable when Busy
@ 2026-10-30 17:31 Pauli Virtanen
2026-10-30 20:47 ` [RESEND,BlueZ] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Pauli Virtanen @ 2026-10-30 17:31 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
Link: https://lore.kernel.org/all/6ae4b5dc.60f493e6.387f6f.e5a9@mx.google.com/
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
end of thread, other threads:[~2026-10-30 20:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30 17:31 [PATCH RESEND BlueZ] test: functional: retry pairable when Busy Pauli Virtanen
2026-10-30 20:47 ` [RESEND,BlueZ] " 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