Skip to content

Commit f1c3963

Browse files
committed
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
1 parent 0d237ae commit f1c3963

File tree

1 file changed

+53
-29
lines changed

1 file changed

+53
-29
lines changed

doc/src/sgml/regress.sgml

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -825,53 +825,77 @@ PG_TEST_NOCLEAN=1 make -C src/bin/pg_dump check
825825
instrumentation, so that it becomes possible to examine which
826826
parts of the code are covered by the regression tests or any other
827827
test suite that is run with the code. This is currently supported
828-
when compiling with GCC, and it requires the <command>gcov</command>
829-
and <command>lcov</command> programs.
828+
when compiling with GCC, and it requires the <literal>gcov</literal>
829+
and <literal>lcov</literal> packages.
830830
</para>
831831

832-
<para>
833-
A typical workflow looks like this:
832+
<sect2 id="regress-coverage-configure">
833+
<title>Coverage with Autoconf and Make</title>
834+
<para>
835+
A typical workflow looks like this:
834836
<screen>
835837
./configure --enable-coverage ... OTHER OPTIONS ...
836838
make
837839
make check # or other test suite
838840
make coverage-html
839841
</screen>
840-
Then point your HTML browser
841-
to <filename>coverage/index.html</filename>.
842-
</para>
842+
Then point your HTML browser
843+
to <filename>coverage/index.html</filename>.
844+
</para>
843845

844-
<para>
845-
If you don't have <command>lcov</command> or prefer text output over an
846-
HTML report, you can run
846+
<para>
847+
If you don't have <command>lcov</command> or prefer text output over an
848+
HTML report, you can run
847849
<screen>
848850
make coverage
849851
</screen>
850-
instead of <literal>make coverage-html</literal>, which will
851-
produce <filename>.gcov</filename> output files for each source file
852-
relevant to the test. (<literal>make coverage</literal> and <literal>make
853-
coverage-html</literal> will overwrite each other's files, so mixing them
854-
might be confusing.)
855-
</para>
852+
instead of <literal>make coverage-html</literal>, which will
853+
produce <filename>.gcov</filename> output files for each source file
854+
relevant to the test. (<literal>make coverage</literal> and <literal>make
855+
coverage-html</literal> will overwrite each other's files, so mixing them
856+
might be confusing.)
857+
</para>
856858

857-
<para>
858-
You can run several different tests before making the coverage report;
859-
the execution counts will accumulate. If you want
860-
to reset the execution counts between test runs, run:
859+
<para>
860+
You can run several different tests before making the coverage report;
861+
the execution counts will accumulate. If you want
862+
to reset the execution counts between test runs, run:
861863
<screen>
862864
make coverage-clean
863865
</screen>
864-
</para>
866+
</para>
865867

866-
<para>
867-
You can run the <literal>make coverage-html</literal> or <literal>make
868-
coverage</literal> command in a subdirectory if you want a coverage
869-
report for only a portion of the code tree.
870-
</para>
868+
<para>
869+
You can run the <literal>make coverage-html</literal> or <literal>make
870+
coverage</literal> command in a subdirectory if you want a coverage
871+
report for only a portion of the code tree.
872+
</para>
871873

872-
<para>
873-
Use <literal>make distclean</literal> to clean up when done.
874-
</para>
874+
<para>
875+
Use <literal>make distclean</literal> to clean up when done.
876+
</para>
877+
</sect2>
878+
879+
<sect2 id="regress-coverage-meson">
880+
<title>Coverage with Meson</title>
881+
<para>
882+
A typical workflow looks like this:
883+
<screen>
884+
meson setup -Db_coverage=true ... OTHER OPTIONS ... builddir/
885+
meson compile -C builddir/
886+
meson test -C builddir/
887+
cd builddir/
888+
ninja coverage-html
889+
</screen>
890+
Then point your HTML browser
891+
to <filename>./meson-logs/coveragereport/index.html</filename>.
892+
</para>
893+
894+
<para>
895+
You can run several different tests before making the coverage report;
896+
the execution counts will accumulate.
897+
</para>
898+
</sect2>
875899
</sect1>
876900

877901
</chapter>

0 commit comments

Comments
 (0)