HNHacker News
TopNewBestAskShowJobs

rkday

89 karma · joined November 5, 2015

submissionscomments
rkday··on Clang vs. GCC – code coverage checking
I can see that it wouldn't always be ideal, but on this (admittedly relatively niche) codebase - core telephone network infrastructure, which we only support on Ubuntu and which we build with GCC - the kind of clang/MSVC incompatibilities you talk about aren't a problem, and the reliability requirements are high enough that it's worth having CI check for 100% test coverage.

I think it's a question of field rather than philosophy - someone else in this thread said they do the same thing in avionics.

rkday··on Clang vs. GCC – code coverage checking
Thanks for pointing out how old GCC 4.8 is! You're right that a comparison against a later version of GCC is fairer - I've tested with GCC 5.3 (the latest I can easily get) and updated the blog post. (5.3 doesn't spot the missing coverage either.)
rkday··on Clang vs. GCC – code coverage checking
We actually hook it into our build process. Basically:

* we have 100% code coverage except for some well-defined exclusions (e.g. // LCOV_EXCL_LINE comments to exclude code that is logically unhittable)

* on each checkin, our continuous integration server (Jenkins) runs the tests and checks that coverage is still 100%

* if not, it fails the build

This means that _every new checkin_ either has unit tests that exercise all the code, or // LCOV_EXCL comments that make it obvious to a code reviewer what isn't covered (and they can then sensibly judge the risk). It's a good way to keep our code quality high, and avoid the possibility that we quietly skimp on unit tests when under deadline pressure. Also, if new members of the team don't realise how important good unit test coverage is, they'll find that out on their first checkin when the build breaks, rather than several weeks in.