[PATCH] D28156: Add the 'googlemock' component of Google Test to LLVM's unittest libraries.

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 29 11:38:36 PST 2016


silvas added a comment.

> I think that #2 is relatively rarely useful, but there *are* cases where
>  it is useful. Historically, I think misuse of actual mocking as
>  described in #2 has led to resistance towards this framework. I am
>  actually sympathetic to this -- mocking can easily be overused. However
>  I think this is not a significant concern in LLVM. First and foremost,
>  LLVM has very careful and rare exposure of abstract interfaces or
>  dependency injection, which are the most prone to abuse with mocks. So
>  there are few opportunities to abuse them. Second, a large fraction of
>  LLVM's unittests are testing *generic code* where mocks actually make
>  tremendous sense. And gmock is well suited to building interfaces that
>  exercise generic libraries. Finally, I still think we should be willing
>  to have testing utilities in tree even if they should be used rarely. We
>  can use code review to help guide the usage here.
> 
> Thoughts?

You brought this up a couple years ago in the llvmdev thread "[LLVMdev] Any objections to my importing GoogleMock to go with GoogleTest in LLVM?" and was rejected (or at least stalled out) at the time. The context was also the same (wanting to unittest the new PM).

I think that if the discussion of whether integrate gmock was important enough at the time to bring to llvmdev, that discussion probably still needs to be done on llvmdev.

One thing that was missing last time was a compelling patch showing how gmock can really simplify one of the tests. If you come into a fresh discussion with such an example, I think it is going to be a much clearer decision this time.


https://reviews.llvm.org/D28156





More information about the llvm-commits mailing list