Commit d35043f
committed
fix(coverage): match .gcno to .gcda by basename, not path-strip
The previous algorithm in run-tests-isolated.bash's collect_coverage
function stripped leading path components off a .gcda relative
path and looked up `${WORKSPACE}/<stripped>.gcno`. That only
works when the .gcda relative path is a path-suffix of the .gcno
absolute path -- and for the ProxySQL daemon it's not.
The proxysql binary is built with CWD=/opt/proxysql/lib/, so the
embedded path in each .gcda is /opt/proxysql/lib/obj/X.gcda. The
daemon container runs with GCOV_PREFIX=/gcov and
GCOV_PREFIX_STRIP=3, which drops /opt/proxysql/lib/, landing the
.gcda at /gcov/obj/X.gcda. The matching .gcno is at
${WORKSPACE}/lib/obj/X.gcno -- but the previous lookup only tried
${WORKSPACE}/obj/X.gcno and ${WORKSPACE}/X.gcno, never thinking to
prepend lib/. Result: every daemon .gcda was logged by fastcov as
"Missing 'current_working_directory'" with an empty files list, and
the .info report came out 0 bytes.
This replaces the strip-and-retry loop with an index built from
`find ${WORKSPACE} -name '*.gcno'` mapping basename -> path, and
looks each .gcda up by basename. Robust to GCOV_PREFIX_STRIP,
build CWD, and arbitrary path layouts. ProxySQL doesn't reuse
.cpp basenames across directories, so basename collision is not
a concern.
Also emits a `matched=N unmatched=M` summary so the next time
something goes wrong with coverage, the failure mode is loud.
Requires the companion change on GH-Actions ci-builds.yml
(extends the _src cache to include proxysql/lib/obj/*.gcno) --
without that, the .gcno files for daemon-side lib code aren't
available in the test workflow's WORKSPACE at all.1 parent 3a594d2 commit d35043f
1 file changed
Lines changed: 40 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
326 | 348 | | |
| 349 | + | |
| 350 | + | |
327 | 351 | | |
328 | 352 | | |
329 | 353 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
342 | 364 | | |
| 365 | + | |
| 366 | + | |
343 | 367 | | |
344 | 368 | | |
345 | 369 | | |
| |||
0 commit comments