diff --git a/TODO.md b/TODO.md index f6632da..3b57f8a 100644 --- a/TODO.md +++ b/TODO.md @@ -586,6 +586,35 @@ Each was found by a test written to assert correct behavior. dedicated `controllerdb` target, or an `OUTPUT` that matches where the script actually writes — so an ordinary build neither needs the network nor dirties the tree. +13. **A stale build tree in the source directory breaks the coverage run.** + `CMakeLists.txt:208` and `CMakeLists.txt:223` pass + `--root "${CMAKE_CURRENT_SOURCE_DIR}"` to gcovr, and gcovr searches for + `.gcda`/`.gcno` files under the root. The `--object-directory` argument on + the line below each does *not* narrow that search: per `gcovr --help` it + only identifies "the path between gcda files and the directory where the + compiler was originally run". So every instrumented build tree left inside + the source directory is folded into the report alongside the one actually + being measured. + + With a `build-coverage/` from an earlier session still present, a freshly + configured `-DAKGL_COVERAGE=ON` tree fails in `coverage_reset`, before any + test runs: + + AssertionError: Got function akgl_game_lowfps on multiple lines: 45, 46. + + 45 and 46 are that function's line numbers before and after an unrelated + `#include` was added to `src/game.c`: gcovr found 18 stale `.gcno` files + describing the old layout, merged them with the current ones, and could not + reconcile the two. Moving `build-coverage/` aside makes the same tree pass + 18/18. Verified with gcovr 7.0. + + The `build*/` entry in `.gitignore` hides these trees from `git status`, + which makes the state easier to get into and no easier to notice. + + Fix: pass the build tree to gcovr as an explicit search path instead of + letting it default to `--root`, so only the tree under measurement is + considered. Touches the two `add_test` blocks at `CMakeLists.txt:204-211` + and `CMakeLists.txt:220-229`; nothing outside the `AKGL_COVERAGE` branch. ## Build notes