lib/googletest: Move to a new googletest package

gtest/gmock are not normally used by users unless running the tests,
so they shouldn't be in the utilities package.  Move them to a new
googletest package, to match what we did with ATF/Kyua.

While here, move tests dependencies from tests-all.ucl to tests.ucl,
which is the canonical place for that.

This change adds a new package to the system so, until we have a proper
policy on how to handle this in release/stable branches, it should not
be MFC'd.

MFC after:	never
Reported by:	emaste
Reviewed by:	manu
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53607
This commit is contained in:
Lexi Winter
2025-11-06 14:34:41 +00:00
parent 6a12f58434
commit 0c90c9ad46
6 changed files with 61 additions and 20 deletions
+2
View File
@@ -1,5 +1,7 @@
.include <googletest.test.inc.mk>
PACKAGE?= googletest
GTEST_DIR= ${SRCTOP}/contrib/googletest
GOOGLEMOCK_SRCROOT= ${GTEST_DIR}/googlemock
GOOGLETEST_SRCROOT= ${GTEST_DIR}/googletest
+3
View File
@@ -1,4 +1,7 @@
.PATH: ${SRCTOP}/tests
PACKAGE= tests
KYUAFILE= yes
# Note: we start the gmock_main and gmock tests first since those take up to
+2
View File
@@ -3,6 +3,8 @@
# rather than installing all of them to /usr/tests/lib/googletest
TESTSDIR= ${TESTSBASE}/lib/googletest/${.CURDIR:T}
PACKAGE= tests
# Clang's optimizer spends a really long time on these tests at -O2. Changing
# -O2 to -O1 reduces the -j32 time for lib/googletest/test from 131s to 71s.
# Using -O0 further reduces the time to 29s, and also reduces the disk usage
+33
View File
@@ -0,0 +1,33 @@
/*
* SPDX-License-Identifier: ISC
*
* Copyright (c) 2025 Lexi Winter <ivy@FreeBSD.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
comment = "Unit testing framework"
desc = <<EOD
Google Test (gtest) is an xUnit-based unit testing framework for C++,
developed by Google LLC.
This version of Google Test is provided for use by unit tests in the
base system, and is not intended for third-party users. A supported
version of Google Test may be found in the FreeBSD Ports Collection
as devel/googletest.
EOD
annotations {
set = "optional,optional-jail"
}
-18
View File
@@ -23,24 +23,6 @@ The test suite, installed in /usr/tests, allows the functionality of the
installed system to be verified.
EOD
deps {
# Nearly all the tests require atf to run.
"atf": {
version = "${VERSION}"
},
# The test framework requires Kyua.
"kyua": {
version = "${VERSION}"
},
# Since the purpose of the tests is to test the base system, the base
# system must be installed.
"set-base": {
version = "${VERSION}"
}
}
annotations {
set = tests
}
+21 -2
View File
@@ -18,10 +18,29 @@
deps {
# Nearly all the tests require atf to run.
"atf": {
version = "${VERSION}"
},
# Quite a few tests require flua.
"flua" {
version = "${VERSION}"
},
# Some tests need GoogleTest
"googletest": {
version = "${VERSION}"
},
# The test framework requires Kyua.
"kyua": {
version = "${VERSION}"
},
# Since the purpose of the tests is to test the base system, the base
# system must be installed.
"set-base": {
version = "${VERSION}"
}
}