capsicum-test: Disable `HAVE_SEND_RECV_MMSG` again
04c4b2084eb9 accidentally added some changes from another WIP commit into that
diff. Instead of wholesale reverting the change, just revert the part that's
currently broken (`HAVE_SEND_RECV_MMSG`). While some of the related tests pass,
one of the testcases (`capmode.cc:AllowedMmsgSendRecv`) doesn't currently pass.
Revert the change to make the CI run more green again.
MFC after: 1 week
Fixes: 04c4b2084eb9 ("capsicum-test: make the code WARNS=6 clean")
(cherry picked from commit 71eddb44d7dfa60e43f77c90b51bd091f0693f85)
contrib/kyua: update config.h for 0.15.1 -> 0.15.2
This was accidentally missed in the prior commit.
This commit addresses a largely cosmetic issue.
MFC after: 6 days
MFC with: c16da33701d0
Fixes: c16da33701d0 contrib/kyua: update to 0.15.2
(cherry picked from commit d9daf5ae796518af1793f919156fb6feba05959d)
tests/sys/capsicum: Fix -Wshadow issue with `fd_set`
`fd_set` is defined in `sys/select.h`, and prior to this change, was in fcntl.cc as well.
This change renames `fd_set` to `fd_set_` to avoid the name collision.
MFC after: 1 week
Reported by: gcc 14
Fixes: 04c4b2084eb9 ("capsicum-test: make the code WARNS=6 clean")
(cherry picked from commit a479301abb2c7b384f574fcc641e502f70654835)
capsicum-test: make the code WARNS=6 clean
Make the code WARNS=6 clean by doing the following:
- Renaming variables (-Wshadow).
- Use memcpy instead of assigning the result of CMSG_DATA to a variable
(-Wcast-align).
- Wrap some macros with do-while(0) to avoid variable collisions
(-Wshadow).
- Push one of the TRACE statements up by 1 layer to avoid a collision
between 2 calls of TRACE via the same overarching macro.
This was needed in order for the code to build properly with D61066,
since the code was not compiling with WARNS set to 3 at the testcase
level.
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D61080
(cherry picked from commit 04c4b2084eb93fc2374dbb89f343f3941585a640)
GoogleTest: run several tests as plain C++ tests
Some of the tests provided by GoogleTest don't play well with the kyua
GoogleTest engine available in 0.15.0, in part because they test
edgecases that the kyua GoogleTest engine does not expect or handle
gracefully.
Treat the tests as plain C++ tests to keep parity (result-wise) before
switching the testcase type from `plain` (what it is today under the
covers) to `googletest`.
MFC after: 1 month
MFC with: 3fb03fb35b20 ("[tests] switch GoogleTest tests to ...")
(cherry picked from commit eecc84de3572d1ee6caac1fa14dd3140c9601c9c)
tests/sys/capsicum: restore test coverage with root user
This change builds capsicum_test and installs/runs it as an unprivileged
user ("tests" in vanilla FreeBSD) and root.
This required adjusting logic in the Makefile in order to build two
binaries with the same sources and running them as separate binaries.
Moreover, in order to restore coverage and ensure that some tests which
require `other_uid` (typically specified via `-u` on the CLI with the
test program) don't fail, become the "tests" user when run as root. This
technically doesn't honor unprivileged_user property in kyua.conf: the
property needs to be passed via a command-line parameter to the test
program.
MFC after: 1 week
Reported by: markj
Fixes: 3fb03fb35b20 ("[tests] switch GoogleTest tests ...")
[4 lines not shown]
[tests] switch GoogleTest tests to `googletest` interface
The new `googletest` kyua test interface--added in 0.15.0 and fixed in
0.15.1--allows tests to be executed and handled in a more fine-grained
manner than the way it was prior to this commit.
This change deletes the `capsicum-test` ATF wrapper script,
`functional.sh`, and all supporting logic in `googletest.test.mk` as
well as this change makes that logic unnecessary.
MFC after: 1 month
MFC with: b68969979d6b ("contrib/kyua: update to 0.15.1")
(cherry picked from commit 3fb03fb35b20d259e0a3a07fc48f2ecc3c5da6e8)
src: Use gnu++17 as the default C++ standard
Previously the compiler's default C++ standard was used unlike C where
bsd.sys.mk explicitly sets a default language version. Setting an
explicit default version will give a more uniform experience across
different compilers and compiler versions.
gnu++17 was chosen to match the default C standard. It is well
supported by a wide range of clang (5+) and GCC (9+) versions.
gnu++17 is also the default C++ standard in recent versions of clang
(16+) and GCC (11+). As a result, many of the explicit CXXSTD
settings in Makefiles had the effect of lowering the C++ standard
instead of raising it as was originally intended and are removed.
Note that the remaining explicit CXXSTD settings for atf and liblutok
explicitly lower the standard to C++11 due to use of the deprecated
auto_ptr<> template which is removed in later versions.
[4 lines not shown]
capsicum-tests: remove Linux support
Now that this project is part of freebsd-src, it no longer needs to be
portable. Remove Linux-only tests, cross-os compatibility code, and
compatibility with older FreeBSD versions. Leave in place some
originally Linux-only tests that could now be ported to FreeBSD, like the
pipe2 tests.
Sponsored by: ConnectWise
Reviewed by: oshogbo
Differential Revision: https://reviews.freebsd.org/D54985
(cherry picked from commit fba81b33aabff74ad03d5f9f9663c176cf060fa6)
tests: sys/capsicum/functional requires mqueuefs
Skip this test if mqueuefs isn't loaded. Unfortunately, that will skip
the entire googletest test program, including test cases that don't
require mqueuefs. But the test's own skipping logic doesn't work, and
we don't yet have a googletest-compatible require_kmods() function.
MFC after: 2 weeks
Sponsored by: ConnectWise
Reviewed by: emaste, ngie
Differential Revision: https://reviews.freebsd.org/D54902
(cherry picked from commit df68a09ea2ec18ee975fb937d46a18250d4663c8)
MAINTAINERS, CODEOWNERS: Update capsicum-test
Fixes: 670b568ec1c3 ("capsicum-test: Move out of contrib")
Sponsored by: The FreeBSD Foundation
(cherry picked from commit b773da180e02c0c27de48dbba72f3fb7a64656da)
capsicum-test: Move out of contrib
Google developed the Capsicum unit test suite[1] as part of the
Capsicum-Linux[2] project, based on unit tests that existed in FreeBSD
and unit tests developed as part of the initial Capsicum-Linux port.
Capsicum-Linux was archived as of October 31, 2022 and is no longer
being maintained. FreeBSD is currently the only consumer of and
contributor to the test suite. Move the src into tests/sys/capsicum to
simplify ongoing maintenance.
The makefiles were deleted as we (continue to) use the existing bespoke
FreeBSD Makefile, and CONTRIBUTING.md was removed as the Google CLA is
no longer applicable.
[1] https://github.com/google/capsicum-test
[2] https://github.com/google/capsicum-linux
Reviewed by: asomers, oshogbo
[4 lines not shown]
fchroot(2): audit
The AUE_FCHROOT identifier was already added, but not used to audit the
fchroot(2) syscall.
Reported by: llm-postcr
Fixes: b165e9e3ea4e ("Add fchroot(2)")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Remove CDDL and ctfconvert tests when their controlling knobs are disabled
In the event someone specified MK_CDDL == no prior to this change, all
tests under `/usr/tests/cddl` would stick around after the change,
resulting in errors. Similarly, MK_DTRACE == no removed ctfconvert,
which the ctfconvert tests relied on (but remained around after the knob
was disabled).
Remove the tests under the respective blocks now so they don't linger
around on systems where these knobs are disabled, resulting in false
positives when running the complete test suite.
The ctfconvert tests weren't specifically put under
`${MK_DTRACE_TESTS}` == no because ctfconvert was bundled separately
from the upstream provided Dtrace test suite.
MFC after: 2 weeks
MFC with: 30c20ca26 ("Remove Dtrace/ZFS tests if their knobs are disabled")
(cherry picked from commit df6131e2b74d9f334c16387e9a46cafd6e27eb78)
Don't some prune empty dirs created by BSD.tests.dist
Before this change, directories needed when MK_DTRACE_TESTS != no and
MK_ZFS_TESTS != no but not MK_TESTS != no, were being created via
`BSD.tests.dist` as part of the standard build/install process with the
top-level `hierarchy` target. This behavior resulted in `make check-old`
flagging a lot of issues after 30c20ca26e105c, even after `make
delete-old` was run and the directories were removed.
Remove the logic which pruned these empty directories; this "fixes" the
issue with `make check-old`, et al and allows a proper technical solution to
`OptionalObsoleteFiles.inc` to be implemented by pkgbase in an unimpeded
manner without introducing additional complexity.
See the review for more details.
PR: 299650
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D60928
[2 lines not shown]
Remove Dtrace/ZFS tests if their knobs are disabled
Prior to this change, Dtrace and ZFS tests and their respective
directories would remain installed even if `${MK_DTRACE_TESTS}` == no or
`${MK_ZFS_TESTS}` == no.
This change enhances the logic to remove the tests when the respective
knobs are disabled so the tests will be removed when `make delete-old`
is run.
MFC after: 2 weeks
(cherry picked from commit 30c20ca26e105cffc5f37a95964cd9b2cad1b6cd)
Remove Dtrace/ZFS tests if their knobs are disabled
Prior to this change, Dtrace and ZFS tests and their respective
directories would remain installed even if `${MK_DTRACE_TESTS}` == no or
`${MK_ZFS_TESTS}` == no.
This change enhances the logic to remove the tests when the respective
knobs are disabled so the tests will be removed when `make delete-old`
is run.
MFC after: 2 weeks
(cherry picked from commit 30c20ca26e105cffc5f37a95964cd9b2cad1b6cd)
Don't some prune empty dirs created by BSD.tests.dist
Before this change, directories needed when MK_DTRACE_TESTS != no and
MK_ZFS_TESTS != no but not MK_TESTS != no, were being created via
`BSD.tests.dist` as part of the standard build/install process with the
top-level `hierarchy` target. This behavior resulted in `make check-old`
flagging a lot of issues after 30c20ca26e105c, even after `make
delete-old` was run and the directories were removed.
Remove the logic which pruned these empty directories; this "fixes" the
issue with `make check-old`, et al and allows a proper technical solution to
`OptionalObsoleteFiles.inc` to be implemented by pkgbase in an unimpeded
manner without introducing additional complexity.
See the review for more details.
PR: 299650
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D60928
[2 lines not shown]
Remove CDDL and ctfconvert tests when their controlling knobs are disabled
In the event someone specified MK_CDDL == no prior to this change, all
tests under `/usr/tests/cddl` would stick around after the change,
resulting in errors. Similarly, MK_DTRACE == no removed ctfconvert,
which the ctfconvert tests relied on (but remained around after the knob
was disabled).
Remove the tests under the respective blocks now so they don't linger
around on systems where these knobs are disabled, resulting in false
positives when running the complete test suite.
The ctfconvert tests weren't specifically put under
`${MK_DTRACE_TESTS}` == no because ctfconvert was bundled separately
from the upstream provided Dtrace test suite.
MFC after: 2 weeks
MFC with: 30c20ca26 ("Remove Dtrace/ZFS tests if their knobs are disabled")
(cherry picked from commit df6131e2b74d9f334c16387e9a46cafd6e27eb78)
net/ieee_oui.h: clarify how `OUI_FREEBSD_BASE` is managed
Note that the FreeBSD Foundation manages the current value
associated with `OUI_FREEBSD_BASE`.
Trim trailing whitespace in comments in the change while here.
MFC after: 1 week
Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/82
(cherry picked from commit 529e9a00ddd3a207f3841c6581c9f1a23532972e)
net/ieee_oui.h: clarify how `OUI_FREEBSD_BASE` is managed
Note that the FreeBSD Foundation manages the current value
associated with `OUI_FREEBSD_BASE`.
Trim trailing whitespace in comments in the change while here.
MFC after: 1 week
Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/82
(cherry picked from commit 529e9a00ddd3a207f3841c6581c9f1a23532972e)