Skip to content

tests, build: fix the coverage report of the nightly runs - #4220

Merged
igaw merged 2 commits into
linux-nvme:masterfrom
dwsuse:fix-gcovr-mock-fuzz
Oct 19, 2026
Merged

igaw merged 2 commits into
linux-nvme:masterfrom
dwsuse:fix-gcovr-mock-fuzz

Conversation

@dwsuse

@dwsuse dwsuse commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

The nightly runs fail since 2026-10-18 in the coverage step, after all tests passed. gcovr aborts in all three jobs (blktests, nvme-cli tests, daemon tests):

GcovrMergeAssertionError: tests/cli/libmock_nvme.c:737 Got function ipc_call on multiple lines: 604, 737.

Since c60974b ("tests/cli: answer the commands from a fuzz input"), libmock_nvme.c is built twice, as libmock_nvme.so and with -DMOCK_FUZZ into fuzz-device. ipc_call() and connect_ipc_socket() each have a definition per build, at different lines, and gcovr refuses to merge a function it finds on two lines.

  • tests/cli: define each mock function once for both builds — one definition per function with MOCK_FUZZ inside the body; the fuzz variant becomes fuzz_ipc_call().
  • build: keep the internal functions in the coverage report — gcovr drops every function starting with __ as compiler internal, which are libnvme's internal helpers (72 of them in a local run). gcovr 8.7 also crashes on such C functions (gcovr 8.7: KeyError 320 gcovr/gcovr#1319, root cause and reproducer posted there). The nightly uses Fedora's 8.6 for now. A gcovr.cfg in the root sets include-internal-functions for all callers, the nightly jobs as well as scripts/build.sh.

Tested locally with a -Db_coverage=true build: before the fix, gcovr 8.6 fails with the CI error; after it, gcovr 8.6 and 8.7 both succeed and the report includes the __ functions. The full test suite passes.

Since the device fuzz target builds libmock_nvme.c with MOCK_FUZZ,
ipc_call() and connect_ipc_socket() each have two definitions, one
per build and at different lines. A coverage build has data from both,
and gcovr fails to merge a function it finds on two lines:

  GcovrMergeAssertionError: tests/cli/libmock_nvme.c:737 Got function
  ipc_call on multiple lines: 604, 737.

This breaks the coverage report of all nightly test runs.

Define each function once and move the MOCK_FUZZ condition into the
body. The fuzz variant of ipc_call() becomes fuzz_ipc_call().

Fixes: c60974b ("tests/cli: answer the commands from a fuzz input")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
gcovr drops all functions starting with '__' as compiler internal. In
libnvme these are the internal helpers, so their coverage is missing
from the report. And gcovr 8.7 fails on any such C function:

  KeyError: 1083

Keep them with include-internal-functions. A gcovr.cfg in the root
directory applies it to all callers, the nightly runs as well as
scripts/build.sh.

Link: gcovr/gcovr#1319
Signed-off-by: Daniel Wagner <dwagner@suse.de>
@igaw
igaw merged commit a4802ab into linux-nvme:master Oct 19, 2026
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants