diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2022-02-14 12:20:02 +0100 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2022-02-14 12:20:02 +0100 |
commit | d282e57e2a93f034d7f7936f87fc5cb67d913151 (patch) | |
tree | de037bf1ec63620757f6bf295108c0a2c8376325 /test/test-functions | |
parent | e4c822e9acbee9dda3f1821056af81eb090f2265 (diff) | |
download | systemd-d282e57e2a93f034d7f7936f87fc5cb67d913151.tar.gz |
test: check for (possibly) missing test coverage
If the test logs contain lines like:
```
...systemd-resolved[735885]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-250.a.p/base-filesystem.c.gcda:Cannot open
```
it means we're possibly missing some coverage since gcov can't write the stats,
usually due to the sandbox being too restrictive (e.g. ProtectSystem=yes,
ProtectHome=yes) or the $BUILD_DIR being inaccessible to non-root users.
Diffstat (limited to 'test/test-functions')
-rw-r--r-- | test/test-functions | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test-functions b/test/test-functions index 84f1e4f5d5..2c13baab04 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1387,6 +1387,20 @@ check_coverage_reports() { lcov --remove "${dest}" -o "${dest}" '/usr/include/*' '/usr/lib/*' fi + # If the test logs contain lines like: + # + # ...systemd-resolved[735885]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-250.a.p/base-filesystem.c.gcda:Cannot open + # + # it means we're possibly missing some coverage since gcov can't write the stats, + # usually due to the sandbox being too restrictive (e.g. ProtectSystem=yes, + # ProtectHome=yes) or the $BUILD_DIR being inaccessible to non-root users - see + # `setfacl` stuff in install_compiled_systemd(). + + if "${JOURNALCTL:?}" -q --no-pager -D "${root:?}/var/log/journal" --grep "profiling:.+?gcda:[Cc]annot open"; then + derror "Detected possibly missing coverage, check the journal" + return 1 + fi + return 0 } |