aboutsummaryrefslogtreecommitdiffstats
path: root/capmode.cc
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2019-03-29 21:41:14 +0000
committerEnji Cooper <ngie@FreeBSD.org>2019-03-29 21:41:14 +0000
commit33d7e3ee781b9ac620b4a49c472c63948e51b08c (patch)
tree06bf5caaf3455a2d6f3dee5149d7143cb541aa5a /capmode.cc
parente5a5dd6cc488f19e182ad3f694957389e4a7d40a (diff)
downloadsrc-vendor/google/capsicum-test.tar.gz
src-vendor/google/capsicum-test.zip
Merge the following changes from the capsicum-test project [1]vendor/google/capsicum-test
Log: ``` commit feb47278d7cffa8cf4bc8c8ff78047126fa41e82 (HEAD -> dev, origin/dev, origin/HEAD) Author: ngie-eign <1574099+ngie-eign@users.noreply.github.com> Date: Fri Mar 22 10:51:04 2019 -0700 Remove `FAIL` macro use for non-x86 architectures when testing `sysarch(2)` (#38) `FAIL()` does not support being called in the form noted in the test, which causes a test failure on non-x86 architectures. The alternatives (use `ADD_TEST_FAILURE()` or `GTEST_SKIP()`) would be misleading (in both cases), and in the case of `GTEST_SKIP()` is unavailable on the version of googletest packaged with capsicum-test. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com> commit 32ad0f3e4c11be7f7463d40eef8d4a78ac9f61a5 Author: Enji Cooper <yaneurabeya@gmail.com> Date: Fri Mar 15 20:01:56 2019 -0700 Fix `-Wunused-parameter` issues Remove variable declarations from functions/methods where the variable is not required. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com> commit 9437b4c550110200ef190ac39fb26c1d8fc55d9a Author: Enji Cooper <yaneurabeya@gmail.com> Date: Fri Mar 15 19:59:00 2019 -0700 Fix `-Wshadow` issues with `EXPECT_OPEN_OK(..)` macro * Wrap in do-while(0) block to avoid variable shadowing issue with multiple calls in the same function. * Prefix block local variables with `_` to try and avoid variable name clashes with values local to test methods. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com> commit adf4a21a233b5da5cac440f4006e258ffba09510 Author: Enji Cooper <yaneurabeya@gmail.com> Date: Fri Mar 15 19:55:00 2019 -0700 Fix `-Wmissing-variable-declarations` issue with `known_rights` global Staticize it since it is only used in the file. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com> ``` This merges a number of the outstanding changes made locally to ^/projects/capsicum-test that were accepted into the upstream project. The sync was done like so: ``` curl -L https://github.com/google/capsicum-test/tarball/dd7eac98c0cf | tar --strip-components=1 -xvzf - -C dist/ rm -Rf dist/*/ ``` 1. https://github.com/google/capsicum-test
Notes
Notes: svn path=/vendor/google/capsicum-test/dist/; revision=345715
Diffstat (limited to 'capmode.cc')
-rw-r--r--capmode.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/capmode.cc b/capmode.cc
index eb4e5c9ff929..567773f319d9 100644
--- a/capmode.cc
+++ b/capmode.cc
@@ -132,7 +132,9 @@ FORK_TEST_F(WithFiles, AllowedFileSyscalls) {
#ifdef HAVE_CHFLAGS
rc = fchflags(fd_file_, UF_NODUMP);
- if (rc < 0) EXPECT_NE(ECAPMODE, errno);
+ if (rc < 0) {
+ EXPECT_NE(ECAPMODE, errno);
+ }
#endif
char buf[1024];
@@ -173,7 +175,9 @@ FORK_TEST_F(WithFiles, AllowedSocketSyscalls) {
// recvfrom() either returns -1 with EAGAIN, or 0.
int rc = recvfrom(fd_socket_, NULL, 0, MSG_DONTWAIT, NULL, NULL);
- if (rc < 0) EXPECT_EQ(EAGAIN, errno);
+ if (rc < 0) {
+ EXPECT_EQ(EAGAIN, errno);
+ }
char ch;
EXPECT_OK(write(fd_file_, &ch, sizeof(ch)));
@@ -558,8 +562,7 @@ FORK_TEST_F(WithFiles, AllowedMiscSyscalls) {
long sysarch_arg = 0;
EXPECT_CAPMODE(sysarch(I386_SET_IOPERM, &sysarch_arg));
#else
- // TOOD(jra): write a test for arm
- FAIL("capmode:no sysarch() test for current architecture");
+ // TOOD(jra): write a test for other architectures, like arm
#endif
#endif
}
@@ -627,7 +630,7 @@ FORK_TEST(Capmode, NewThread) {
}
static int had_signal = 0;
-static void handle_signal(int x) { had_signal = 1; }
+static void handle_signal(int) { had_signal = 1; }
FORK_TEST(Capmode, SelfKill) {
pid_t me = getpid();