git: 0c90c9ad4649 - main - lib/googletest: Move to a new googletest package
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 06 Nov 2025 15:22:53 UTC
The branch main has been updated by ivy:
URL: https://cgit.FreeBSD.org/src/commit/?id=0c90c9ad4649789feec86c776674491c35cc7e27
commit 0c90c9ad4649789feec86c776674491c35cc7e27
Author: Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2025-11-06 14:34:41 +0000
Commit: Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2025-11-06 15:20:52 +0000
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
---
lib/googletest/Makefile.inc | 2 ++
lib/googletest/tests/Makefile | 3 +++
lib/googletest/tests/Makefile.inc | 2 ++
release/packages/ucl/googletest-all.ucl | 33 +++++++++++++++++++++++++++++++++
release/packages/ucl/tests-all.ucl | 18 ------------------
release/packages/ucl/tests.ucl | 21 ++++++++++++++++++++-
6 files changed, 60 insertions(+), 19 deletions(-)
diff --git a/lib/googletest/Makefile.inc b/lib/googletest/Makefile.inc
index 231d7545f364..43ebace19a15 100644
--- a/lib/googletest/Makefile.inc
+++ b/lib/googletest/Makefile.inc
@@ -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
diff --git a/lib/googletest/tests/Makefile b/lib/googletest/tests/Makefile
index 886b1a2fe49d..350e0fe765fe 100644
--- a/lib/googletest/tests/Makefile
+++ b/lib/googletest/tests/Makefile
@@ -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
diff --git a/lib/googletest/tests/Makefile.inc b/lib/googletest/tests/Makefile.inc
index 9691aaa93ded..8d19e1fafdea 100644
--- a/lib/googletest/tests/Makefile.inc
+++ b/lib/googletest/tests/Makefile.inc
@@ -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
diff --git a/release/packages/ucl/googletest-all.ucl b/release/packages/ucl/googletest-all.ucl
new file mode 100644
index 000000000000..889e8a65f314
--- /dev/null
+++ b/release/packages/ucl/googletest-all.ucl
@@ -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"
+}
diff --git a/release/packages/ucl/tests-all.ucl b/release/packages/ucl/tests-all.ucl
index 3ad2d0f50e6b..315ac2e8cce0 100644
--- a/release/packages/ucl/tests-all.ucl
+++ b/release/packages/ucl/tests-all.ucl
@@ -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
}
diff --git a/release/packages/ucl/tests.ucl b/release/packages/ucl/tests.ucl
index bac72f1534d3..da9eb59295bc 100644
--- a/release/packages/ucl/tests.ucl
+++ b/release/packages/ucl/tests.ucl
@@ -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}"
+ }
+}