Apparently GCC defines NULL to 0 in C++11 mode (instead of nullptr), so this causes the following error: ``` In file included from capsicum-test.h:15, from capsicum-test.cc:1: gtest-1.10.0/include/gtest/gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperNE(const char*, const char*, const T1&, const T2&) [with T1 = long int; T2 = procstat*]': capsicum-test.cc:75:3: required from here gtest-1.10.0/include/gtest/gtest.h:1621:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 1609 | if (val1 op val2) {\ | ~~~~~~~~~~~~ ...... 1621 | GTEST_IMPL_CMP_HELPER_(NE, !=); gtest-1.10.0/include/gtest/gtest.h:1609:12: note: in definition of macro 'GTEST_IMPL_CMP_HELPER_' 1609 | if (val1 op val2) {\ | ^~ ``` Fix this by using nullptr directly. Submitted upstream as https://github.com/google/capsicum-test/pull/56 Reported by: Jenkins CI |
||
---|---|---|
.. | ||
.gitignore | ||
capability-fd-pair.cc | ||
capability-fd.cc | ||
capmode.cc | ||
capsicum-freebsd.h | ||
capsicum-linux.h | ||
capsicum-rights.h | ||
capsicum-test-main.cc | ||
capsicum-test.cc | ||
capsicum-test.h | ||
capsicum.h | ||
CONTRIBUTING.md | ||
fcntl.cc | ||
fexecve.cc | ||
GNUmakefile | ||
ioctl.cc | ||
LICENSE | ||
linux.cc | ||
makefile | ||
mini-me.c | ||
mqueue.cc | ||
openat.cc | ||
overhead.cc | ||
procdesc.cc | ||
README.md | ||
rename.cc | ||
sctp.cc | ||
select.cc | ||
showrights | ||
smoketest.c | ||
socket.cc | ||
syscalls.h | ||
sysctl.cc | ||
waittest.c |
Capsicum User Space Tests
This directory holds unit tests for Capsicum object-capabilities. The tests exercise the syscall interface to a Capsicum-enabled operating system, currently either FreeBSD >=10.x or a modified Linux kernel (the capsicum-linux project).
The tests are written in C++98, and use the Google Test framework, with some additions to fork off particular tests (because a process that enters capability mode cannot leave it again).
Provenance
The original basis for these tests was:
- unit tests written by Robert Watson and Jonathan Anderson for the original FreeBSD 9.x Capsicum implementation
- unit tests written by Meredydd Luff for the original Capsicum-Linux port.
These tests were coalesced and moved into an independent repository to enable comparative testing across multiple OSes, and then substantially extended.
OS Configuration
Linux
The following kernel configuration options are needed to run the tests:
CONFIG_SECURITY_CAPSICUM
: enable the Capsicum frameworkCONFIG_PROCDESC
: enable Capsicum process-descriptor functionalityCONFIG_DEBUG_FS
: enable debug filesystemCONFIG_IP_SCTP
: enable SCTP support
FreeBSD (>= 10.x)
The following kernel configuration options are needed so that all tests can run:
options P1003_1B_MQUEUE
: Enable POSIX message queues (orkldload mqueuefs
)
Other Dependencies
Linux
The following additional development packages are needed to build the full test suite on Linux.
libcaprights
: See belowlibcap-dev
: Provides headers for POSIX.1e capabilities.libsctp1
: Provides SCTP library functions.libsctp-dev
: Provides headers for SCTP library functions.
Linux libcaprights
The Capsicum userspace library is held in the libcaprights/
subdirectory. Ideally, this
library should be built (with ./configure; make
or dpkg-buildpackage -uc -us
) and
installed (with make install
or dpkg -i libcaprights*.deb
) so that the tests will
use behave like a normal Capsicum-aware application.
However, if no installed copy of the library is found, the GNUmakefile
will attempt
to use the local libcaprights/*.c
source; this requires ./configure
to have been
performed in the libcaprights
subdirectory. The local code is also used for
cross-compiled builds of the test suite (e.g. make ARCH=32
or make ARCH=x32
).