From bcaaae15ae65fe8b2f0c2f9cb55c777a57eb5de4 Mon Sep 17 00:00:00 2001 From: Evan Benn Date: Fri, 4 Nov 2022 17:00:40 +1100 Subject: tests: Detect gcov run and redirect to real I/O functions Code coverage writes data to disk, we need to use real io functions at this point so that the data is really written. BUG=b:187647884 BRANCH=None TEST=meson test TEST=ninja coverage Change-Id: If06053ecd78e886c8f7fc55813f4b5635be78c6b Signed-off-by: Evan Benn Reviewed-on: https://review.coreboot.org/c/flashrom/+/69266 Reviewed-by: Anastasia Klimchuk Tested-by: build bot (Jenkins) --- Documentation/building.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Documentation') diff --git a/Documentation/building.md b/Documentation/building.md index aabb45b1..81daeb06 100644 --- a/Documentation/building.md +++ b/Documentation/building.md @@ -48,6 +48,18 @@ ninja -C builddir install ninja -C builddir test ``` +### Run unit tests with code coverage +#### gcov +Due to a bug in lcov, the html file will only be correct if lcov is not +installed and gcovr is installed. See +https://github.com/linux-test-project/lcov/issues/168 +https://github.com/mesonbuild/meson/issues/6747 +``` +meson setup buildcov -Db_coverage=true +ninja -C buildcov test +ninja -C buildcov coverage +``` + ## System specific information ### Ubuntu / Debian (Linux) * __linux-headers__ are version specific -- cgit v1.2.3