After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668608 - Add code coverage support
Add code coverage support
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: general
3.4.x (obsolete)
Other All
: Normal normal
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2012-01-24 20:09 UTC by Philip Withnall
Modified: 2013-09-14 16:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add an --enable-code-coverage configure option (26.71 KB, patch)
2012-01-24 20:10 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2012-01-24 20:09:17 UTC
It's always nice to be able to measure things, and measuring the code coverage of the EDS test suite (or of external programs which are testing EDS, which is what I'm interested in) would be nice.

Patch coming up to add an --enable-code-coverage option to EDS’ configure script which will compile EDS with gcov support when enabled.

This patch won’t include any automake targets for making nice coverage reports using lcov, or anything like that. I think that’s a prime candidate for a re-usable m4 file to handle, which I can look into if anybody wants it.
Comment 1 Philip Withnall 2012-01-24 20:10:33 UTC
Created attachment 206014 [details] [review]
Add an --enable-code-coverage configure option
Comment 2 Milan Crha 2012-03-21 18:03:06 UTC
I suppose the coverage is part of gcc itself, right? I'm wondering whether any checking can be done before "just using it". The other question is why to add things like this:
 +libebookbackendfile_la_CFLAGS = \
 +	$(AM_CFLAGS) \
 +	$(CODE_COVERAGE_CFLAGS) \
 +	$(NULL)
when the code (successfully, I believe) uses CPPFLAGS part, thus just add your $(CODE_COVERAGE_CFLAGS) to the place where all other CFLAGS currently are. (I know, we can discuss now that eds is no CPP project, but still, this seems to work thus there should not be a problem with it).

The last thing, it would be nice to have a note in the configure finish section, to have there shown whether it is compiled with coverage enabled or not - you know, add a line into the table of "evolution-data-server has been configured as follows:" at the very bottom of the configure.ac file.

Apart of these three things I'm fine with the change.
Comment 3 Philip Withnall 2012-03-21 18:54:38 UTC
(In reply to comment #2)
> I suppose the coverage is part of gcc itself, right? I'm wondering whether any
> checking can be done before "just using it".

Yeah, the coverage is implemented by gcc linking some atexit code into the binary and enabling debug symbols. I don't know of any checks which are needed other than checking that the compiler is gcc.

> The other question is why to add
> things like this:
>  +libebookbackendfile_la_CFLAGS = \
>  +    $(AM_CFLAGS) \
>  +    $(CODE_COVERAGE_CFLAGS) \
>  +    $(NULL)
> when the code (successfully, I believe) uses CPPFLAGS part, thus just add your
> $(CODE_COVERAGE_CFLAGS) to the place where all other CFLAGS currently are. (I
> know, we can discuss now that eds is no CPP project, but still, this seems to
> work thus there should not be a problem with it).

CPPFLAGS is technically for pre-processor flags (not C++ flags) and so that's why I used CFLAGS (which is for C compiler flags). I know that in practice just using CPPFLAGS works, but it's technically not correct.

> The last thing, it would be nice to have a note in the configure finish
> section, to have there shown whether it is compiled with coverage enabled or
> not - you know, add a line into the table of "evolution-data-server has been
> configured as follows:" at the very bottom of the configure.ac file.

OK, if there are no other problems I'll come up with a revised patch with this change sometime in the next few days.
Comment 4 Milan Crha 2012-03-22 12:08:52 UTC
(In reply to comment #3)
> CPPFLAGS is technically for pre-processor flags (not C++ flags) and so that's
> why I used CFLAGS (which is for C compiler flags). I know that in practice just
> using CPPFLAGS works, but it's technically not correct.

OK, I didn't know that. I only know that the code had been "finegrained" some time ago, and even I do not know what was the exact reason to use CPPFLAGS only, I just follow current pattern. Your addition of CFLAGS is making a bit of noise there. I prefer to use current eds habit, and if that will show up as a mistake, than all the Makefile.am files would be fixed anyway, in once.

> > The last thing, it would be nice to have a note in the configure finish
> > section, to have there shown whether it is compiled with coverage enabled or
> > not - you know, add a line into the table of "evolution-data-server has been
> > configured as follows:" at the very bottom of the configure.ac file.
> 
> OK, if there are no other problems I'll come up with a revised patch with this
> change sometime in the next few days.

Yes please, do both of them and then feel free to commit to master, after it's branched.
Comment 5 Philip Withnall 2012-03-26 10:30:49 UTC
Comment on attachment 206014 [details] [review]
Add an --enable-code-coverage configure option

Committed with the configure summary output and CPPFLAGS changes.

commit 3bc3fa26e53895b14eadabe2ed617e67e18fab96
Author: Philip Withnall <philip@tecnocode.co.uk>
Date:   Tue Jan 24 20:06:03 2012 +0000

    build: Add an --enable-code-coverage configure option to enable gcov support
    
    When enabled, this will compile all the EDS libraries (but not test programs)
    with the necessary GCC and ld flags to enable code coverage support using
    gcov.
    
    Closes: https://bugzilla.gnome.org/show_bug.cgi?id=668608

 addressbook/backends/file/Makefile.am              |    8 ++++++--
 addressbook/backends/google/Makefile.am            |    8 ++++++--
 addressbook/backends/ldap/Makefile.am              |    8 ++++++--
 addressbook/backends/vcf/Makefile.am               |    8 ++++++--
 addressbook/backends/webdav/Makefile.am            |    8 ++++++--
 addressbook/libebook/Makefile.am                   |    8 ++++++--
 addressbook/libedata-book/Makefile.am              |    8 ++++++--
 addressbook/libegdbus/Makefile.am                  |    8 ++++++--
 calendar/backends/caldav/Makefile.am               |    8 ++++++--
 calendar/backends/contacts/Makefile.am             |    8 ++++++--
 calendar/backends/file/Makefile.am                 |    8 ++++++--
 calendar/backends/http/Makefile.am                 |    8 ++++++--
 calendar/backends/weather/Makefile.am              |    8 ++++++--
 calendar/libecal/Makefile.am                       |    8 ++++++--
 calendar/libedata-cal/Makefile.am                  |    8 ++++++--
 calendar/libegdbus/Makefile.am                     |    8 ++++++--
 camel/Makefile.am                                  |    8 ++++++--
 camel/providers/imap/Makefile.am                   |    8 ++++++--
 camel/providers/imapx/Makefile.am                  |    8 ++++++--
 camel/providers/local/Makefile.am                  |    8 ++++++--
 camel/providers/nntp/Makefile.am                   |    8 ++++++--
 camel/providers/pop3/Makefile.am                   |    8 ++++++--
 camel/providers/sendmail/Makefile.am               |    8 ++++++--
 camel/providers/smtp/Makefile.am                   |    8 ++++++--
 configure.ac                                       |   19 +++++++++++++++++++
 libebackend/Makefile.am                            |    8 ++++++--
 libedataserver/Makefile.am                         |    8 ++++++--
 libedataserverui/Makefile.am                       |    9 +++++++--
 services/evolution-addressbook-factory/Makefile.am |    6 ++++++
 services/evolution-calendar-factory/Makefile.am    |    6 ++++++
 30 files changed, 194 insertions(+), 54 deletions(-)