]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: check for (possibly) missing test coverage 22505/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 14 Feb 2022 11:20:02 +0000 (12:20 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 14 Feb 2022 11:20:02 +0000 (12:20 +0100)
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.

test/test-functions

index 84f1e4f5d58ad12496fb6afefc6cf714651cda80..2c13baab048369e27a8537b37488d14b5fc80bb4 100644 (file)
@@ -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
 }