[LLVMdev] Any objections to my importing GoogleMock to go with GoogleTest in LLVM?
Alp Toker
alp at nuanti.com
Thu Nov 14 12:02:49 PST 2013
On 14/11/2013 18:58, Chris Lattner wrote:
>
> I’ve said this before, but I’m not a fan of our current use of gtest
> for unit testing. I have never had the unit tests catch a bug, but I
> have had to update the tests countless times.
Agree on this point specifically. There are any number of unit tests
using functions that are otherwise unused or deeply internal, and it
feels too often like googletest is being used as a means to freeze
chunks of the internal API for consumption by external projects we don't
know about.
Looking through the revision history for cfe/unittests/ is revealing --
out of a thousand commits I couldn't find a single one removing a test
by someone outside Google in the last year.
Studying the commits, you can see the pattern: Once a test is in, it
becomes something the rest of the platform works around. I don't think
this is intentional but it's become an unfortunate consequence.
To take an example from something I was working on last week, there are
parts of the Rewrite/MemoryBuffer interface that need changes both for
performance and to fix Windows crashers, but the unit tests specify so
much internal behaviour it's challenging to do so without modifying the
tests. (We've been told from a young age not to remove tests, they're
there for a reason!)
If the purpose of the unit tests is to keep parts of the internal API
stable for external projects, I'd like that to be made more clear, and
inversely that it's OK to liberally remove unit tests that get in the
way of real work, that should also be explained.
Mock tests are notorious for modelling a rigid interface and behaviour.
Wouldn't they just amplify the problems I've cited?
Alp.
--
http://www.nuanti.com
the browser experts
More information about the llvm-dev
mailing list