Coverage reports with gccgo and lcov

272 views
Skip to first unread message

Albert Strasheim

unread,
Mar 12, 2012, 8:42:58 AM3/12/12
to golan...@googlegroups.com
Hello all

You can now generate coverage reports for Go commands and tests using gccgo and lcov!

lcov actually needs a bugfix, which is available in the Fedora package:


The lcov author should release a fixed version soon:


Steps:

cd ~/myproj
rm -rf go-build* html
TMPDIR=`pwd` GOPATH=`pwd` go test -compiler=gccgo -gccgoflags '--coverage -g -O0' -v -work ./...
lcov --directory go-build* --capture --output-file myproj.info
genhtml -o html -s myproj.info

You can also produce reports understood by the Jenkins Cobertura plugin using gcovr:


You might have to tweak one line in gcovr:

output_re = re.compile("[cC]reating [`'](.*)'$")

Make sure you have the latest gccgo and go from tip.

Some example output here:


Regards,

Albert

P.S. A few issues to watch out for:

Reply all
Reply to author
Forward
0 new messages