Skip to content

Commit 946a6f6

Browse files
committed
Documentation: Document the coverage build a bit more
1 parent b24c7d3 commit 946a6f6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Documentation/AdvancedBuildInstructions.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ There are some optional features that can be enabled during compilation that are
5959
- `ENABLE_KERNEL_UNDEFINED_SANITIZER`: builds in runtime checks for detecting undefined behavior in the kernel.
6060
- `ENABLE_KERNEL_UNDEFINED_SANITIZER_ALWAYS_DEADLY`: makes the aforementioned runtime checks always deadly, as seen by the compiler.
6161
- `ENABLE_KERNEL_COVERAGE_COLLECTION`: enables the KCOV API and kernel coverage collection instrumentation. Only useful for coverage guided kernel fuzzing.
62+
- `ENABLE_LAGOM_COVERAGE_COLLECTION`: enables coverage collection instrumentation for lagom builds. Currently only works with a Clang build.
6263
- `ENABLE_USERSPACE_COVERAGE_COLLECTION`: enables coverage collection instrumentation for userspace. Currently only works with a Clang build.
6364
- `ENABLE_MEMORY_SANITIZER`: enables runtime checks for uninitialized memory accesses in Lagom test cases.
6465
- `ENABLE_UNDEFINED_SANITIZER`: builds in runtime checks for [undefined behavior](https://en.wikipedia.org/wiki/Undefined_behavior) (like null pointer dereferences and signed integer overflows) in Lagom and the SerenityOS userland.
@@ -250,3 +251,26 @@ Some OS distributions don't ship bleeding-edge clang-format binaries. Below are
250251
1. If you have a Debian-based (apt-based) distribution, use the [LLVM apt repositories](https://apt.llvm.org) to install the latest release of clang-format.
251252
2. Compile the SerenityOS-patched LLVM from source using `Toolchain/BuildClang.sh` as described above and use the compiled `Toolchain/Local/clang/bin/clang-format` binary in your editor and terminal. The meta-lint-ci pre-commit hook will automatically pick up the Toolchain clang-format binary.
252253
3. Compile LLVM from source as described in the LLVM documentation [here](https://llvm.org/docs/GettingStarted.html#compiling-the-llvm-suite-source-code).
254+
255+
## Coverage builds
256+
257+
For serenity builds, Meta/analyze-qemu-coverage.sh can help you.
258+
259+
For lagom builds, you currently have to do the same thing manually:
260+
261+
1. Enable `ENABLE_LAGOM_COVERAGE_COLLECTION` in BUild/lagom/CMakeCache.txt
262+
2. Build: `Meta/serenity.sh build lagom TestImageDecoder`
263+
3. Run tests: `(cd Tests/LibGfx; ../../Build/lagom/bin/TestImageDecoder)`
264+
4. Generate report, requires an LLVM checkout and build:
265+
266+
~/src/llvm-project/llvm/utils/prepare-code-coverage-artifact.py \
267+
--unified-report \
268+
-C Build/lagom \
269+
~/src/llvm-project/out/gn/bin/llvm-profdata \
270+
~/src/llvm-project/out/gn/bin/llvm-cov \
271+
Tests/LibGfx \
272+
report-output \
273+
Build/lagom/bin/TestImageDecoder \
274+
Build/lagom/lib/liblagom-gfx.dylib
275+
276+
5. `open report-output/TestImageDecoder/index.html`

0 commit comments

Comments
 (0)