* [PATCH BlueZ v1 1/2] build: Fix coverage target failing with stale .gcda files
@ 2026-09-28 20:47 Luiz Augusto von Dentz
2026-09-28 20:47 ` [PATCH BlueZ v1 2/2] test-runner: Share build directory writable on coverage builds Luiz Augusto von Dentz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2026-09-28 20:47 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Coverage data from a previous build is not overwritten by 'make check'
for binaries that are not run by it, causing geninfo to fail with a
stamp mismatch once the objects are rebuilt. Zero the counters before
running the tests and mark the targets as phony since coverage/ is also
the output directory.
Assisted-by: Claude:claude-opus-5.5
---
Makefile.am | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 53a3a15c3f8b..24760ab08687 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -999,7 +999,11 @@ if COVERAGE
@lcov --directory $(top_builddir) --zerocounters
$(RM) -r coverage $(top_builddir)/coverage.info
-coverage: check
+.PHONY: coverage clean-coverage
+
+coverage:
+ @lcov --directory $(top_builddir) --zerocounters
+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check
@lcov --compat-libtool --directory $(top_builddir) --capture \
--output-file $(top_builddir)/coverage.info
$(AM_V_at)$(MKDIR_P) coverage
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH BlueZ v1 2/2] test-runner: Share build directory writable on coverage builds
2026-09-28 20:47 [PATCH BlueZ v1 1/2] build: Fix coverage target failing with stale .gcda files Luiz Augusto von Dentz
@ 2026-09-28 20:47 ` Luiz Augusto von Dentz
2026-09-28 22:37 ` [BlueZ,v1,1/2] build: Fix coverage target failing with stale .gcda files bluez.test.bot
2026-09-29 15:20 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2026-09-28 20:47 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The root filesystem is shared read-only with the guest so gcov is not
able to write the .gcda files of binaries run by test-runner, e.g. by
the functional tests. Share the build directory writable over 9p and
mount it over the read-only one when coverage is enabled.
Assisted-by: Claude:claude-opus-5.5
---
Makefile.tools | 3 +++
tools/test-runner.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+)
diff --git a/Makefile.tools b/Makefile.tools
index 671b40fb0e42..658f92d7b9db 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -325,6 +325,9 @@ tools_btgatt_server_LDADD = src/libshared-mainloop.la \
lib/libbluetooth-internal.la
tools_test_runner_CFLAGS = $(WARNING_CFLAGS)
+if COVERAGE
+tools_test_runner_CFLAGS += -DHAVE_COVERAGE
+endif
tools_test_runner_LDFLAGS =
tools_rctest_LDADD = lib/libbluetooth-internal.la
diff --git a/tools/test-runner.c b/tools/test-runner.c
index 338e5b9da544..674ce072d959 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -577,6 +577,46 @@ static void terminate_signal(int sig)
terminate = 1;
}
+#define COVERAGE_TAG "bluez-coverage"
+
+static bool coverage_enabled(void)
+{
+#ifdef HAVE_COVERAGE
+ return true;
+#else
+ return false;
+#endif
+}
+
+/* The root filesystem is shared read-only, so gcov would be unable to write
+ * the .gcda files of the binaries run inside the guest. Share the build
+ * directory writable so it can be mounted over the read-only one.
+ */
+static void coverage_setup(struct strv *argv, const char *dir)
+{
+ if (!coverage_enabled())
+ return;
+
+ strv_append(argv, "-fsdev");
+ strv_append(argv, "local,id=fsdev-coverage,path=%s,readonly=off,"
+ "security_model=none,multidevs=remap", dir);
+ strv_append(argv, "-device");
+ strv_append(argv, "virtio-9p-pci,fsdev=fsdev-coverage,"
+ "mount_tag=" COVERAGE_TAG);
+}
+
+static void coverage_mount(const char *dir)
+{
+ if (!coverage_enabled())
+ return;
+
+ printf("Mounting %s writable for coverage\n", dir);
+
+ if (mount(COVERAGE_TAG, dir, "9p", 0,
+ "trans=virtio,version=9p2000.L") < 0)
+ perror("Failed to mount coverage directory");
+}
+
static bool rootfs_setup(struct rootfs *r, struct strv *argv)
{
const char *mem = "256M";
@@ -826,6 +866,8 @@ static int start_qemu(void)
strv_append(&argv, "-append");
strv_append(&argv, "%s", cmdline);
+ coverage_setup(&argv, cwd);
+
for (i = 0; i < num_devs; i++) {
strv_append(&argv, "-chardev");
strv_append(&argv, "socket,path=%s,id=bt%d", device_path, i);
@@ -1456,6 +1498,9 @@ static void run_command(char *cmdname, char *home)
return;
}
+ /* home is "HOME=<dir>" */
+ coverage_mount(home + 5);
+
if (num_devs) {
const char *node = "/dev/hvc1";
unsigned int basic_flags, extra_flags;
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [BlueZ,v1,1/2] build: Fix coverage target failing with stale .gcda files
2026-09-28 20:47 [PATCH BlueZ v1 1/2] build: Fix coverage target failing with stale .gcda files Luiz Augusto von Dentz
2026-09-28 20:47 ` [PATCH BlueZ v1 2/2] test-runner: Share build directory writable on coverage builds Luiz Augusto von Dentz
@ 2026-09-28 22:37 ` bluez.test.bot
2026-09-29 15:20 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-09-28 22:37 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 1022 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/1175582/
---Test result---
Test Summary:
CheckPatch PASS 1.00 seconds
GitLint PASS 0.71 seconds
BuildEll PASS 19.89 seconds
BluezMake PASS 392.34 seconds
MakeCheck PASS 14.72 seconds
MakeDistcheck PASS 146.61 seconds
CheckValgrind PASS 239.11 seconds
CheckSmatch PASS 295.94 seconds
bluezmakeextell PASS 95.19 seconds
TestFunctional PASS 1125.76 seconds
IncrementalBuild PASS 396.82 seconds
ScanBuild PASS 1146.71 seconds
https://github.com/bluez/bluez/pull/2601
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ v1 1/2] build: Fix coverage target failing with stale .gcda files
2026-09-28 20:47 [PATCH BlueZ v1 1/2] build: Fix coverage target failing with stale .gcda files Luiz Augusto von Dentz
2026-09-28 20:47 ` [PATCH BlueZ v1 2/2] test-runner: Share build directory writable on coverage builds Luiz Augusto von Dentz
2026-09-28 22:37 ` [BlueZ,v1,1/2] build: Fix coverage target failing with stale .gcda files bluez.test.bot
@ 2026-09-29 15:20 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2026-09-29 15:20 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Mon, 28 Sep 2026 16:47:30 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> Coverage data from a previous build is not overwritten by 'make check'
> for binaries that are not run by it, causing geninfo to fail with a
> stamp mismatch once the objects are rebuilt. Zero the counters before
> running the tests and mark the targets as phony since coverage/ is also
> the output directory.
>
> [...]
Here is the summary with links:
- [BlueZ,v1,1/2] build: Fix coverage target failing with stale .gcda files
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8814ac26fe65
- [BlueZ,v1,2/2] test-runner: Share build directory writable on coverage builds
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=86713777f91a
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] 4+ messages in thread
end of thread, other threads:[~2026-09-29 15:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-28 20:47 [PATCH BlueZ v1 1/2] build: Fix coverage target failing with stale .gcda files Luiz Augusto von Dentz
2026-09-28 20:47 ` [PATCH BlueZ v1 2/2] test-runner: Share build directory writable on coverage builds Luiz Augusto von Dentz
2026-09-28 22:37 ` [BlueZ,v1,1/2] build: Fix coverage target failing with stale .gcda files bluez.test.bot
2026-09-29 15:20 ` [PATCH BlueZ v1 1/2] " 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