cppunit -> googletest / gmock?

Francesco Chemolli <[email protected]>
Newsgroups gmane.comp.web.squid.devel
Message-ID <CA+Y8hcNLaEkENpAWSUTpy-efkY5ZjS6rvMLH+agPHDaJphPP3g@mail.gmail.com>
Hi all,
   starting from a PR in a conversation with Alex about our current
approach to unit testing being painful, I've checked what alternatives
would we have and how practical would they be.

An easy first option would be googletest/googlemock.

On a lazy afternoon, I've tried seeing how useful/painful it would be to
try it, by porting one test over - it's quite trivial and doesn't require
mocking, so I'll try a more complicated one next - to start a conversation
about the topic.

You can find the test branch at https://github.com/kinkie/squid/tree/gtest .
I've only touched two files, a newly-created src/tests/testMemGtest and
src/Makefile.am .

The output from the test run is at https://paste.ubuntu.com/p/3sgTDN7rNm/

What do you think?

My initial thoughts:
- it is somewhat simpler and more powerful than cppunit
- setting the test environment up is easy but at this time it can only be
done from source. Adding it to the build farm images is straightforward
- the license is BSD 3-clause new (
https://github.com/google/googletest/blob/master/LICENSE)
- googlemock promises to be vastly superior to our current approach
- porting memTest took me about one hour, mostly caused by us including
cppunit headers from squid.h (WUT? A PR is coming up to unentangle that)

-- 
    Francesco

_______________________________________________
squid-dev mailing list
[email protected]
http://lists.squid-cache.org/listinfo/squid-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.