mirror of https://github.com/sysown/proxysql
Daemon-side coverage has been silently empty since gcov was first
wired up. The TAP cascade hits the right code paths and the tester
calls `PROXYSQL GCOV DUMP` after every test (proxysql-tester.py
line 880), and proxysql writes 226 .gcda files into /gcov. But every
single one of them lands with empty metadata:
[error]: Missing 'current_working_directory' for data file:
{'data_file': '/gcov/obj/MySQL_Query_Processor.gcda', 'files': []}
[error]: Missing 'current_working_directory' for data file:
{'data_file': '/gcov/obj/MySQL_Session.gcda', 'files': []}
... (x226)
fastcov gives up on every one of them. The resulting .info file has
zero `lib/*.cpp` SF: entries -- only the ~200 header files indirectly
pulled in by other sources. Codecov then reports
`lib/MySQL_Session.cpp`, `lib/MySQL_Monitor.cpp`,
`lib/MySQL_Protocol.cpp`, `lib/Admin_Handler.cpp`,
`lib/MySQL_Logger.cpp`, `lib/MySQL_PreparedStatement.cpp`,
`lib/ProxySQL_Cluster.cpp` and dozens more at **0% coverage** even
though they're the hottest paths in the daemon.
Root cause: the proxysql binary is built inside the build container
with the source bind-mounted at /opt/proxysql/ (docker-compose.yml
`- ./:/opt/proxysql/`). gcc embeds the .gcno paths into the binary as
`/opt/proxysql/{lib,src}/obj/X.gcno`. At runtime, gcov reads those
.gcno files at startup to populate per-translation-unit metadata that
later goes into the .gcda files written by __gcov_dump(). The
proxysql RUNTIME container has the binary but does NOT have the .gcno
files at /opt/proxysql/{lib,src}/obj/ -- the entire 'current_working
_directory' field of every .gcda comes out blank.
Fix: mount the .gcno files from the build cache into the proxysql
container at the compile-time path. The build cache restore already
puts them at ${WORKSPACE}/lib/obj/*.gcno and ${WORKSPACE}/src/obj/
*.gcno on the runner, so this is just two extra `-v ...:ro` mounts
on the docker run in start-proxysql-isolated.bash.
Always-on, gated on .gcno presence: for a non-coverage build, the
WORKSPACE has no .gcno files and the conditional adds nothing.
This is the missing piece behind every prior coverage attempt --
PR #5817 (lib-only unit tests) bypassed it by running tests in the
same container that built proxysql, PR #5818 (legacy-g2 TAP) hit
exactly this bug and quietly uploaded a near-empty .info that
Codecov merged with the unit-test data, masking the issue under a
reasonable-looking 15% aggregate.
feature/ci-codecov-tap-all-groups-callers
parent
30b2553398
commit
ca90fb540b
Loading…
Reference in new issue