Re: code coverage patch - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: code coverage patch
Date
Msg-id 200808281423.24923.peter_e@gmx.net
Whole thread Raw
In response to code coverage patch  (Michelle Caisse <Michelle.Caisse@Sun.COM>)
Responses Re: code coverage patch  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
Michelle Caisse wrote:
> 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/refi
>nt.so' LANGUAGE C;
> + ERROR:  could not load library
> "/home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/refi
>nt.so":
> /home/michelle/trunkClean/pgsql/src/test/regress/../../../contrib/spi/refin
>t.so: undefined symbol: __gcov_merge_add

The reason for that problem is that the shared object needs to be linked 
with -fprofile-arcs -ftest-coverage.  (One of these causes -lgcov to be 
linked, which includes the missing symbol.)  This is not done because the 
shared object link rules don't use CFLAGS.

I think for most platforms it would actually be more correct to use CFLAGS in 
linking.  There may be the odd exception, but usually CFLAGS contains some 
assortment of -O, -g, -W, and maybe -f options, which should do more good 
than harm when linking.

Any concerns about selectively adding CFLAGS to shared library linking rules?


pgsql-hackers by date:

Previous
From: "Hitoshi Harada"
Date:
Subject: Re: September Commit Fest coming soon!
Next
From: Abhijit Menon-Sen
Date:
Subject: Re: September Commit Fest coming soon!