Fix and simplify code by using ATF_REQUIRE_FEATURE macro
PR: 236857 Reviewed by: asomers, ngie Approved by: emaste MFC after: 1 month Sponsored by: Netflix
This commit is contained in:
parent
a7b6ed1826
commit
9c3e2dda27
@ -55,4 +55,6 @@ WARNS?= 6
|
||||
|
||||
LDFLAGS+= -lbsm -lutil
|
||||
|
||||
CFLAGS.process-control.c+= -I${SRCTOP}/tests
|
||||
|
||||
.include <bsd.test.mk>
|
||||
|
@ -48,6 +48,8 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include "freebsd_test_suite/macros.h"
|
||||
|
||||
static pid_t pid;
|
||||
static int filedesc, status;
|
||||
static struct pollfd fds[1];
|
||||
@ -1512,14 +1514,7 @@ ATF_TC_HEAD(cap_enter_success, tc)
|
||||
|
||||
ATF_TC_BODY(cap_enter_success, tc)
|
||||
{
|
||||
int capinfo;
|
||||
size_t len = sizeof(capinfo);
|
||||
const char *capname = "kern.features.security_capability_mode";
|
||||
ATF_REQUIRE_EQ(0, sysctlbyname(capname, &capinfo, &len, NULL, 0));
|
||||
|
||||
/* Without CAPABILITY_MODE enabled, cap_enter() returns ENOSYS */
|
||||
if (!capinfo)
|
||||
atf_tc_skip("Capsicum is not enabled in the system");
|
||||
ATF_REQUIRE_FEATURE("security_capability_mode");
|
||||
|
||||
FILE *pipefd = setup(fds, auclass);
|
||||
ATF_REQUIRE((pid = fork()) != -1);
|
||||
@ -1550,14 +1545,9 @@ ATF_TC_HEAD(cap_getmode_success, tc)
|
||||
|
||||
ATF_TC_BODY(cap_getmode_success, tc)
|
||||
{
|
||||
int capinfo, modep;
|
||||
size_t len = sizeof(capinfo);
|
||||
const char *capname = "kern.features.security_capability_mode";
|
||||
ATF_REQUIRE_EQ(0, sysctlbyname(capname, &capinfo, &len, NULL, 0));
|
||||
int modep;
|
||||
|
||||
/* Without CAPABILITY_MODE enabled, cap_getmode() returns ENOSYS */
|
||||
if (!capinfo)
|
||||
atf_tc_skip("Capsicum is not enabled in the system");
|
||||
ATF_REQUIRE_FEATURE("security_capability_mode");
|
||||
|
||||
pid = getpid();
|
||||
snprintf(pcregex, sizeof(pcregex), "cap_getmode.*%d.*success", pid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user