git: 83fc6f5bdf81 - main - Revert "tests/sys/capsicum: restore test coverage with root user"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 10 Nov 2026 01:50:51 UTC
The branch main has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=83fc6f5bdf8133359ec5526b9e359fd7d35c12c8
commit 83fc6f5bdf8133359ec5526b9e359fd7d35c12c8
Author: Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-11-10 01:49:25 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-11-10 01:49:37 +0000
Revert "tests/sys/capsicum: restore test coverage with root user"
The wrong patch was applied for D61080. Both changes must go.
This reverts commit dda15b669d021346682009f38acc6db2639fb99f.
---
tests/sys/capsicum/Makefile | 27 +++++++++------------------
tests/sys/capsicum/capsicum-test-main.cc | 24 ------------------------
2 files changed, 9 insertions(+), 42 deletions(-)
diff --git a/tests/sys/capsicum/Makefile b/tests/sys/capsicum/Makefile
index daf508ba7f30..9a88c9cf0ec1 100644
--- a/tests/sys/capsicum/Makefile
+++ b/tests/sys/capsicum/Makefile
@@ -9,11 +9,14 @@ CFLAGS+= -I${SRCTOP}/tests
.if ${MK_GOOGLETEST} != no
-GTESTS+= capsicum-test_privileged
-GTESTS+= capsicum-test_unprivileged
+GTESTS+= capsicum-test
+# This test script runs the same test suite twice, once as root and once as an
+# unprivileged user. Serialize them since some tests access global namespaces,
+# e.g., mqueuefs, and can trample on each other.
+TEST_METADATA.functional+= is_exclusive="true"
+TEST_METADATA.functional+= required_kmods="mqueuefs"
-# SRCS required for `capsicum-test*`.
-SRCS.capsicum-test= \
+SRCS.capsicum-test+= \
capsicum-test-main.cc \
capsicum-test.cc \
capability-fd.cc \
@@ -33,20 +36,8 @@ SRCS.capsicum-test= \
overhead.cc \
rename.cc
-.for gtest in ${GTESTS}
-SRCS.${gtest}= ${SRCS.capsicum-test}
-
-LIBADD.${gtest}+= gtest pthread procstat
-
-# This test script runs the same test suite twice, once as root and once as an
-# unprivileged user. Serialize them since some tests access global namespaces,
-# e.g., mqueuefs, and can trample on each other.
-TEST_METADATA.${gtest}+= is_exclusive="true"
-TEST_METADATA.${gtest}+= required_kmods="mqueuefs"
-.endfor
-
-TEST_METADATA.capsicum-test_privileged+= required_user="root"
-TEST_METADATA.capsicum-test_unprivileged+= required_user="unprivileged"
+LIBADD.capsicum-test+= gtest pthread procstat
+TEST_METADATA.capsicum-test= required_user="unprivileged"
.for p in mini-me mini-me.noexec mini-me.setuid
PROGS+= $p
diff --git a/tests/sys/capsicum/capsicum-test-main.cc b/tests/sys/capsicum/capsicum-test-main.cc
index 308c121a0281..2a2c75000039 100644
--- a/tests/sys/capsicum/capsicum-test-main.cc
+++ b/tests/sys/capsicum/capsicum-test-main.cc
@@ -136,30 +136,6 @@ int main(int argc, char* argv[]) {
}
}
- // Last ditch effort to get an unprivileged user on the fly from /etc/passwd
- // for testcases that need it.
- //
- // This must be done this way because the typical way of handling this (via
- // the `-u` argument) isn't supported yet with kyua:
- // https://github.com/freebsd/kyua/issues/354 .
- //
- // IMPORTANT:
- // - this doesn't honor `unprivileged_user` in `kyua.conf`.
- // - this doesn't fail because doing that could break all testing on systems
- // where the `tests` user isn't available.
- if (other_uid == 0) {
- const char *test_user = "tests";
-
- struct passwd *test_user_entry = getpwnam(test_user);
-
- if (test_user_entry) {
- other_uid = test_user_entry->pw_uid;
- } else {
- std::cerr << "Failed to get entry for " << test_user << ", errno=" << errno << "; some tests may fail" << std::endl;
- }
-
- }
-
testing::AddGlobalTestEnvironment(new SetupEnvironment());
return RUN_ALL_TESTS();
}