Warning: |
GNOME Goal: Add code coverage support with GCOV
Introduction
GCOV is a GCC extension to perform a coverage test of your code, so you can get metrics on the code coverage of your test suite.
From the GCOV documentation "Use it in concert with GCC to analyze your programs to help create more efficient, faster running code and to discover untested parts of your program. You can use gcov as a profiling tool to help discover where your optimization efforts will best affect your code. You can also use gcov along with the other profiling tool, gprof, to assess which parts of your code use the greatest amount of computing time."
Note that this GNOME Goal is not about writing a comprehensive test suite for your module, having just one small unit test is already valuable because that way your module will have the infrastructure to host unit tests, so chances are that more unit tests will be written in the future, which is always beneficial. And with code coverage support, it gives an additional incentive to write more tests, and to know what remains to be tested.
Guidelines
If your module uses the Autotools for the build system, there is the AX_CODE_COVERAGE macro, part of autoconf-archive. The macro was first added to gnome-common, but gnome-common is deprecated, see Projects/GnomeCommon/Migration.
See the Unit Testing page in the GNOME Programming Guidelines to learn the best practices about writing unit tests for GLib-based software.
TODO: write Meson instructions.
Comments before approval
Add your comments to this goal proposal here |
Old comments
JavierJardon: There is a bug report to include coverage support code directly in gnome-common
MatthiasClasen: The link to http://fixed.gnome.org/coverage/glib/lcov/ leads to nowhere - do we actually have lcov reports online anywhere ? That would certainly make this goal much more attractive. Also, the goal description should probably mention that having a 'make check' testsuite is a prerequisite to having useful code coverage reporting.
AndreKlapper: There is also a GTK+ patch awaiting review.
PhilipWithnall: gnome-common has gained a macro for code coverage support, so it should be easier to add gcov support to modules now. There are some example patches for adding code coverage from scratch and porting existing code coverage support using the new macro.
New comments (2017)
SĂ©bastienWilmet: and gnome-common is now deprecated, see Projects/GnomeCommon/Migration. The macro is now in autoconf-archive under the name AX_CODE_COVERAGE. Description of the GNOME goal updated.
Status of this goal
Tip: If you choose to work on a module, create the bug report on the GNOME bugzilla for the relevant module, and make it block bug <<insert here a link to the tracker bug>>. This way people will know someone already works on it, and won't duplicate the work you're doing. |
State |
Markup |
todo |
<: #ff8080> todo |
patch |
<: #ffc849> [[GnomeBug:xxxxx|patch]] |
done |
<: #80ff80> [[GnomeBug:xxxxx|done]] |
not needed |
<: #80ff80> not needed |
Above are the states and corresponding markup to update the modules state table below.
Tarball |
Status |
core |
|
at-spi2-core |
to do |
at-spi2-atk |
to do |
dconf |
to do |
evolution-data-server |
to do |
glib-networking |
to do |
gnome-bluetooth |
to do |
gnome-online-accounts |
to do |
gnome-control-center |
to do |
gnome-desktop |
to do |
adwaita-icon-theme |
to do |
gnome-keyring |
|
gnome-menus |
to do |
gnome-packagekit |
to do |
gnome-session |
to do |
gnome-settings-daemon |
to do |
gnome-shell |
to do |
gnome-themes-standard |
to do |
gsettings-desktop-schemas |
to do |
gvfs |
to do |
mousetweaks |
to do |
mutter |
to do |
network-manager-applet |
to do |
pulseaudio |
to do |
telepathy-mission-control |
to do |
core-utilities |
|
baobab |
to do |
bijiben |
to do |
empathy |
to do |
eog |
to do |
epiphany |
to do |
evince |
to do |
gnome-calculator |
to do |
gnome-characters |
to do |
gnome-contacts |
to do |
gnome-dictionary |
to do |
gnome-disk-utility |
to do |
gnome-font-viewer |
to do |
gnome-logs |
to do |
gnome-screenshot |
to do |
gnome-system-log |
to do |
gnome-system-monitor |
to do |
gnome-terminal |
to do |
gucharmap |
to do |
nautilus |
to do |
sushi |
to do |
yelp |
to do |
core-extras |
|
gnome-backgrounds |
to do |
gnome-user-share |
to do |
vino |
to do |
gnome-user-docs |
to do |
core-os-services |
|
accountsservice |
to do |
avahi |
to do |
bluez |
to do |
to do |
|
cups |
to do |
dbus |
to do |
gdm |
to do |
to do |
|
to do |
|
polkit |
to do |
upower |
to do |
udisks |
to do |
core-deps |
|
atk |
to do |
atkmm |
to do |
cantarell-fonts |
to do |
caribou |
to do |
clutter |
done |
clutter-gtk |
to do |
clutter-gst |
to do |
cogl |
to do |
desktop-file-utils |
to do |
expat |
to do |
folks |
to do |
gnome-js-common |
to do |
gspell |
done |
gtksourceview |
done |
gdk-pixbuf |
to do |
gjs |
to do |
glib |
|
glibmm |
to do |
gnome-video-effects |
to do |
gobject-introspection |
to do |
gst-plugins-base |
to do |
gst-plugins-good |
to do |
gst-plugins-farsight |
to do |
gstreamer |
to do |
gtk+ |
|
gtk-doc |
to do |
gtkmm |
to do |
gudev |
to do |
hicolor-icon-theme |
to do |
iso-codes |
to do |
itstool |
to do |
intltool |
to do |
java-gnome |
to do |
json-glib |
done |
libcanberra |
to do |
libchamplain |
to do |
libcroco |
to do |
libgee |
to do |
libgdata |
done |
libgsf |
to do |
libgtop |
to do |
libgweather |
to do |
libmusicbrainz |
to do |
libnice |
to do |
libnotify |
to do |
libpeas |
to do |
librest |
to do |
librsvg |
to do |
libsecret |
to do |
libsigc++2 |
to do |
libsoup |
to do |
libxml2 |
to do |
mm-common |
to do |
p11-kit |
to do |
pango |
to do |
pangomm |
to do |
poppler |
to do |
pygobject |
to do |
seed |
to do |
shared-mime-info |
to do |
sound-theme-freedesktop |
to do |
telepathy-glib |
to do |
telepathy-logger |
to do |
telepathy-farsight |
to do |
totem-pl-parser |
|
tracker |
to do |
vala |
to do |
vte |
to do |
webkit |
to do |
yelp-tools |
to do |
yelp-xsl |
to do |
zenity |
to do |
lcms2 |
to do |
colord |
to do |
apps |
|
accerciser |
to do |
aislerot |
to do |
anjuta |
to do |
brasero |
to do |
cheese |
to do |
devhelp |
to do |
evolution |
to do |
file-roller |
to do |
gedit |
to do |
ghex |
to do |
glade |
to do |
gnome-boxes |
to do |
gnome-clocks |
to do |
gnome-color-manager |
to do |
gnome-devel-docs |
to do |
gnome-documents |
to do |
gnome-music |
to do |
gnome-software |
to do |
gnome-sound-recorder |
to do |
gnome-weather |
to do |
gnome-chess |
to do |
five-or-more |
to do |
four-in-a-row |
to do |
gnome-klotski |
to do |
gnome-mahjongg |
to do |
gnome-mines |
to do |
gnome-nibbles |
to do |
gnome-robots |
to do |
gnome-sudoku |
to do |
gnome-tetravex |
to do |
iagno |
to do |
lightsoff |
to do |
quadrapassel |
to do |
swell-foop |
to do |
tali |
to do |
gnome-nettool |
to do |
nautilus-sendto |
to do |
nemiver |
to do |
orca |
to do |
rygel |
to do |
seahorse |
to do |
totem |
to do |
vinagre |
to do |