From f1c3963292e4efc7ea65be08a7a26f78bc91e257 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Thu, 9 Mar 2023 09:21:47 +0900 Subject: [PATCH] doc: Add guidelines to generate coverage reports with meson These instructions were already available for configure-based builds, but not the meson-based builds. This commit closes the gap. Reviewed-by: Peter Eisentraut Discussion: https://postgr.es/m/d3751ca3-1ac9-cc5e-9315-cf9fb0eaa9e9@enterprisedb.com --- doc/src/sgml/regress.sgml | 82 +++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml index a08c7a78af..719e0a7698 100644 --- a/doc/src/sgml/regress.sgml +++ b/doc/src/sgml/regress.sgml @@ -825,53 +825,77 @@ PG_TEST_NOCLEAN=1 make -C src/bin/pg_dump check instrumentation, so that it becomes possible to examine which parts of the code are covered by the regression tests or any other test suite that is run with the code. This is currently supported - when compiling with GCC, and it requires the gcov - and lcov programs. + when compiling with GCC, and it requires the gcov + and lcov packages. - - A typical workflow looks like this: + + Coverage with Autoconf and Make + + A typical workflow looks like this: ./configure --enable-coverage ... OTHER OPTIONS ... make make check # or other test suite make coverage-html - Then point your HTML browser - to coverage/index.html. - + Then point your HTML browser + to coverage/index.html. + - - If you don't have lcov or prefer text output over an - HTML report, you can run + + If you don't have lcov or prefer text output over an + HTML report, you can run make coverage - instead of make coverage-html, which will - produce .gcov output files for each source file - relevant to the test. (make coverage and make - coverage-html will overwrite each other's files, so mixing them - might be confusing.) - + instead of make coverage-html, which will + produce .gcov output files for each source file + relevant to the test. (make coverage and make + coverage-html will overwrite each other's files, so mixing them + might be confusing.) + - - You can run several different tests before making the coverage report; - the execution counts will accumulate. If you want - to reset the execution counts between test runs, run: + + You can run several different tests before making the coverage report; + the execution counts will accumulate. If you want + to reset the execution counts between test runs, run: make coverage-clean - + - - You can run the make coverage-html or make - coverage command in a subdirectory if you want a coverage - report for only a portion of the code tree. - + + You can run the make coverage-html or make + coverage command in a subdirectory if you want a coverage + report for only a portion of the code tree. + - - Use make distclean to clean up when done. - + + Use make distclean to clean up when done. + + + + + Coverage with Meson + + A typical workflow looks like this: + +meson setup -Db_coverage=true ... OTHER OPTIONS ... builddir/ +meson compile -C builddir/ +meson test -C builddir/ +cd builddir/ +ninja coverage-html + + Then point your HTML browser + to ./meson-logs/coveragereport/index.html. + + + + You can run several different tests before making the coverage report; + the execution counts will accumulate. + +