From: Pauli Virtanen <pav@iki.fi>
To: Bastien Nocera <hadess@hadess.net>
Cc: linux-bluetooth <linux-bluetooth@vger.kernel.org>
Subject: Re: Integration testing for BlueZ
Date: Mon, 30 Mar 2026 12:59:14 +0000 [thread overview]
Message-ID: <628CF193-5AAC-49F4-A7D0-D4417EC6B4D2@iki.fi> (raw)
In-Reply-To: <177a2b4ff440d84853662e042082f6580e41aed4.camel@hadess.net>
Hi,
30. maaliskuuta 2026 12.38.49 UTC Bastien Nocera <hadess@hadess.net> kirjoitti:
>On Wed, 2026-02-25 at 20:58 +0200, Pauli Virtanen wrote:
>> Hi,
>>
>> ke, 2026-02-25 kello 17:01 +0100, Bastien Nocera kirjoitti:
>> [clip]
>> > > Feel free to git a review to Lars's patch; hopefully, that will
>> > > help
>> > > us get this resolved quicker. We might as well create a unit test
>> > > for
>> > > shell to try to emulate different modes and environments. That
>> > > way,
>> > > we
>> > > prevent introducing regressions like this in the future.
>> >
>> > I wrote one, which I can integrate into meson.
>> >
>> > This starts "btvirt" (so requires root), launches bluetoothd if
>> > there
>> > isn't a daemon already running, and launches "bluetoothctl list".
>> >
>> > You can run it manually with:
>> > $ sudo top_builddir=/path/to/bluez/builddir/ ./integration-test.py
>> >
>> > If "bluetoothctl list" doesn't output any text, the test errors
>> > out.
>> > I've tested that pointing the bluetoothctl_path() output at an old
>> > version of bluetoothctl worked.
>> >
>> > This pattern of using Python to create test suites using python-
>> > dbusmock is something I've already used in PolicyKit, upower,
>> > power-
>> > profiles-daemon, gnome-bluetooth and many other places.
>> >
>> > This test is pretty heavy-handed if we just want to test whether
>> > bluetoothctl outputs things correctly, but it has the benefit of
>> > testing the emulator as well as bluetoothd. We could start adding
>> > more
>> > tests to the mix, such as creating more adapters, pairing them,
>> > etc.
>> >
>> > Hopefully, this is a useful test to run on CIs, although I'm
>> > probably
>> > missing spawning a system bus on top of everything else.
>> >
>> > What do you think?
>>
>> Adding some testing for this is a good idea, and I'd think Python is
>> the way to go.
>>
>> I was planning on pushing this a bit further, and automate also end-
>> to-
>> end integration testing. That is, QEmu instances connected to each
>> other via btvirt, so we can have repeatable tests in a "real"
>> environment.
>>
>> This is maybe overkill for simple bluetoothctl command line tests,
>> but
>> it allows things like automated testing of Pipewire <-> Bluez <->
>> btvirt <-> BlueZ <-> Pipewire audio setup.
>>
>> This involves lots of subsystems, and it's currently 100% relying on
>> manual testing and sometimes things are missed, like breaking A2DP in
>> some setups in 5.86, or breaking BAP in 5.85.
>>
>> Here's a working prototype, needs some more work though so details
>> may
>> change but the general shape is probably going to stay:
>>
>> https://github.com/pv/bluez/blob/func-test/unit/func_test/test_cli_simple.py
>
>Do you still have a copy of the above file somewhere? I wanted to
>finish porting them into my own integration tests which I'm hoping to
>add to the regression/unit tests that are usually run for every
>commit/MR.
https://github.com/pv/bluez/blob/func-test-v3/test/functional/test_bluetoothctl_vm.py
and test_btmgmt_vm.py
Although these don't currently contain much, but could be extended.
FWIW I'd maybe consider using pytest also for Python regression & unit tests, at least if you can make them run without root.
There's interesting bluetoothd mock dbus library by the bluez-alsa developer, which looks like it could be useful for bluetoothctl/etc utility testing
<https://github.com/Samsung/bluezoo>
>
>>
>> https://github.com/pv/bluez/blob/func-test/doc/test-functional.rst
>>
next prev parent reply other threads:[~2026-03-30 12:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 2:32 [PATCH BlueZ 0/2] shared: recover from failed input initialization Ronan Pigott
2026-02-18 2:32 ` [PATCH BlueZ 1/2] zsh: amend completions Ronan Pigott
2026-02-18 3:37 ` shared: recover from failed input initialization bluez.test.bot
2026-02-18 14:56 ` [PATCH BlueZ 1/2] zsh: amend completions Luiz Augusto von Dentz
2026-02-18 2:33 ` [PATCH BlueZ 2/2] shared/shell: gracefully recover from failed input initialization Ronan Pigott
2026-02-18 14:58 ` Luiz Augusto von Dentz
2026-02-18 17:45 ` Ronan Pigott
2026-02-18 18:45 ` Luiz Augusto von Dentz
2026-02-25 16:01 ` Bastien Nocera
2026-02-25 18:58 ` Integration testing for BlueZ Pauli Virtanen
2026-02-27 11:37 ` Bastien Nocera
2026-03-30 12:38 ` Bastien Nocera
2026-03-30 12:59 ` Pauli Virtanen [this message]
2026-03-30 15:03 ` Bastien Nocera
2026-04-05 12:37 ` Pauli Virtanen
2026-02-27 11:31 ` [PATCH BlueZ 2/2] shared/shell: gracefully recover from failed input initialization Bastien Nocera
2026-02-28 17:32 ` Ronan Pigott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=628CF193-5AAC-49F4-A7D0-D4417EC6B4D2@iki.fi \
--to=pav@iki.fi \
--cc=hadess@hadess.net \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox