Skip site navigation (1) Skip section navigation (2)

code coverage patch

From: Michelle Caisse <Michelle(dot)Caisse(at)Sun(dot)COM>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: code coverage patch
Date: 2008-08-27 23:24:52
Message-ID: 48B5E244.80208@sun.com (view raw or flat)
Thread:
Lists: pgsql-hackers
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



Attachment: coverage.diff
Description: text/plain (12.8 KB)

Responses

pgsql-hackers by date

Next:From: ITAGAKI TakahiroDate: 2008-08-28 02:54:54
Subject: Re: Auto-explain patch
Previous:From: Greg StarkDate: 2008-08-27 15:45:27
Subject: Re: Is it really such a good thing for newNode() to be a macro?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group