mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-07 00:50:50 +00:00
tests: Add ATF_REQUIRE_SYSCTL_BOOL
Modify a capability mode test to use it for kern.trap_enotcap, to avoid false positives. MFC after: 1 week Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
fc727ad63d
commit
8a271827e7
|
@ -53,6 +53,18 @@
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
#define ATF_REQUIRE_SYSCTL_BOOL(_mib_name, _required_value) do { \
|
||||||
|
bool value; \
|
||||||
|
size_t size = sizeof(value); \
|
||||||
|
if (sysctlbyname(_mib_name, &value, &size, NULL, 0) == -1) { \
|
||||||
|
atf_tc_skip("sysctl for %s failed: %s", _mib_name, \
|
||||||
|
strerror(errno)); \
|
||||||
|
} \
|
||||||
|
if (value != (_required_value)) \
|
||||||
|
atf_tc_skip("requires %s=%d, =%d", (_mib_name), \
|
||||||
|
(_required_value), value); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define ATF_REQUIRE_SYSCTL_INT(_mib_name, _required_value) do { \
|
#define ATF_REQUIRE_SYSCTL_INT(_mib_name, _required_value) do { \
|
||||||
int value; \
|
int value; \
|
||||||
size_t size = sizeof(value); \
|
size_t size = sizeof(value); \
|
||||||
|
@ -60,8 +72,9 @@
|
||||||
atf_tc_skip("sysctl for %s failed: %s", _mib_name, \
|
atf_tc_skip("sysctl for %s failed: %s", _mib_name, \
|
||||||
strerror(errno)); \
|
strerror(errno)); \
|
||||||
} \
|
} \
|
||||||
if (value != _required_value) \
|
if (value != (_required_value)) \
|
||||||
atf_tc_skip("requires %s=%d", _mib_name, _required_value); \
|
atf_tc_skip("requires %s=%d, =%d", (_mib_name), \
|
||||||
|
(_required_value), value); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define PLAIN_REQUIRE_FEATURE(_feature_name, _exit_code) do { \
|
#define PLAIN_REQUIRE_FEATURE(_feature_name, _exit_code) do { \
|
||||||
|
|
|
@ -80,7 +80,7 @@ check_capsicum(void)
|
||||||
{
|
{
|
||||||
ATF_REQUIRE_FEATURE("security_capabilities");
|
ATF_REQUIRE_FEATURE("security_capabilities");
|
||||||
ATF_REQUIRE_FEATURE("security_capability_mode");
|
ATF_REQUIRE_FEATURE("security_capability_mode");
|
||||||
ATF_REQUIRE_SYSCTL_INT("kern.trap_enotcap", 0);
|
ATF_REQUIRE_SYSCTL_BOOL("kern.trap_enotcap", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue