Page MenuHomeFreeBSD

Do initial googlemock/googletest integration into the build/FreeBSD test suite
ClosedPublic

Authored by ngie on Mar 11 2019, 11:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 21, 7:05 PM
Unknown Object (File)
Tue, Dec 17, 7:30 AM
Unknown Object (File)
Nov 23 2024, 2:18 AM
Unknown Object (File)
Nov 22 2024, 4:36 PM
Unknown Object (File)
Nov 21 2024, 8:01 AM
Unknown Object (File)
Nov 20 2024, 5:33 AM
Unknown Object (File)
Nov 16 2024, 8:17 AM
Unknown Object (File)
Nov 15 2024, 5:37 AM

Details

Summary

This initial integration takes googlemock/googletest release 1.8.1, integrates
the library, tests, and sample unit tests into the build.

googlemock/googletest’s inclusion is optionally available via MK_GOOGLETEST. MK_GOOGLETEST is dependent on
MK_TESTS and is enabled by default when built with a C++11 capable toolchain.

Google tests can be specified via the GTESTS variable, which, in comparison
with the other test drivers, is more simplified/streamlined, as Googletest only supports C++ tests; not raw C or shell tests (C tests can be written in C++ using the standard embedding methods).

No dependent libraries are assumed for the tests. One must specify gmock,
gmock_main, gtest, or gtest_main, via LIBADD for the program.

More information about googlemock and googletest can be found on the
Googletest project page and the
GoogleMock
and
GoogleTest
docs.

These tests are originally integrated into the build as plain driver tests, but
will be natively integrated into Kyua in a later version.

Known issues/Errata:

Test Plan

I have run all of the integration tests successfully, minus
WhenDynamicCastToTest.AmbiguousCast. I have marked the testcase as an
expected failure, so it does not affect the overall test suite result.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 23024
Build 22096: arc lint + arc unit

Event Timeline

share/mk/Makefile
76

Should these files be conditionalized on MK_GOOGLETEST?

share/mk/googletest.test.inc.mk
10

Why do you have to specify -std=c++11? What happens if you don't? Clang defaults to the gnu++14. With this in there, I have to manually add -std=c++14 to my own makefile.

tools/build/options/WITHOUT_GOOGLETEST
1–2

s/not/neither/g

ngie marked 2 inline comments as done.Mar 12 2019, 1:16 AM
ngie added a subscriber: dim.
ngie added inline comments.
share/mk/Makefile
76

If I do, it would introduce unnecessary complexity and dependencies on src.opts.mk, and make it impossible for others to use bsd.test.mk in ports, etc :/...

share/mk/googletest.test.inc.mk
10

googletest compiles with -std=c++11 right now. I will made this optional via CXXSTD, like I suggested to @dim a while (2 years or so) ago, and will work on shuffling the value/flag setting over to bsd.sys.mk, etc.

ngie marked an inline comment as done.

Update based on comments from @asomers

share/mk/Makefile
76

Makes sense.

share/mk/googletest.test.inc.mk
10

Are you saying that googletest itself requires -std=c++11? or that any googletest client needs c++11 at a minimum?

share/mk/googletest.test.inc.mk
10

Mostly the latter, however, newer versions of the spec might break functionality developed and tested with c++11 (very unlikely, but possible).

share/mk/googletest.test.inc.mk
10

Ok, but why put it in this file instead of bsd.sys.mk ?

ngie marked an inline comment as done.Mar 12 2019, 3:13 PM
ngie added inline comments.
share/mk/googletest.test.inc.mk
10

I hadn’t gotten around to figuring out the appropriate format for putting it in there. I’ll work on it in parallel with this though.

ngie marked an inline comment as done.Mar 12 2019, 3:26 PM
ngie added inline comments.
share/mk/googletest.test.inc.mk
10

The reason why this matters is that PowerPC and mips are both still built with gcc 4.2.1, which will require a lower language spec version than clang and not all versions of clang support the C++11 spec.

asomers added inline comments.
share/mk/googletest.test.inc.mk
10

Ahh, that would explain why you put it in this file, because PowerPC and mips don't use this file.

This revision is now accepted and ready to land.Mar 12 2019, 3:28 PM

Why is this review still open? Was the Phabricator hook not working on the day that you committed?

Why is this review still open? Was the Phabricator hook not working on the day that you committed?

I think it choked on the commit import *sigh*.