I've attached a patch that allows the generation of code coverage
statistics. To test it, apply the patch, then:
autoconf
./configure --enable-coverage
make
make check (or execute any other application against the database to see
the coverage of that app)
make coverage
make coverage_out
You will find a coverage directory in your build directory. Open
coverage/index.html to see the code coverage.
There are a couple of issues.
gcov gets confused when source files are generated. I eliminated
src/backend/bootstrap and ../parser from coverage analysis to avoid
errors of this type. With a vpath build only, code coverage fails on
another generated .c file, src/backend/utils/misc/guc-file.c.
Also, two tests fail with the following diff when the build is
configured with --enable-coverage.
RETURNS trigger
AS
'/home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/refint.so'
LANGUAGE C;
+ ERROR: could not load library
"/home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/refint.so":
/home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/refint.so:
undefined symbol: __gcov_merge_add
CREATE FUNCTION check_foreign_key ()
RETURNS trigger
AS
'/home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/refint.so'
LANGUAGE C;
+ ERROR: could not load library
"/home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/refint.so":
/home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/refint.so:
undefined symbol: __gcov_merge_add
CREATE FUNCTION autoinc ()
RETURNS trigger
AS
'/home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/autoinc.so'
LANGUAGE C;
+ ERROR: could not load library
"/home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/autoinc.so":
/home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/autoinc.so:
undefined symbol: __gcov_merge_add
CREATE FUNCTION funny_dup17 ()
RETURNS trigger
AS '/home/michelle/trunkClean/pgsql/src/test/regress/regress.so'
Please test and comment.
-- Michelle
--
Michelle Caisse Sun Microsystems
California, U.S. http://sun.com/postgresql
Responses
pgsql-hackers by date
| Next: | From: ITAGAKI Takahiro | Date: 2008-08-28 02:54:54 |
| Subject: Re: Auto-explain patch |
| Previous: | From: Greg Stark | Date: 2008-08-27 15:45:27 |
| Subject: Re: Is it really such a good thing for newNode() to be a macro? |