mirror of
https://github.com/systemd/systemd.git
synced 2025-03-09 12:58:26 +03:00
test-seccomp: log function names
Various tests produce similar output, and the function names make it easier to see where the output is generated.
This commit is contained in:
parent
23e12f8e6c
commit
f09da7ccbc
@ -36,6 +36,8 @@ static void test_seccomp_arch_to_string(void) {
|
|||||||
uint32_t a, b;
|
uint32_t a, b;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
a = seccomp_arch_native();
|
a = seccomp_arch_native();
|
||||||
assert_se(a > 0);
|
assert_se(a > 0);
|
||||||
name = seccomp_arch_to_string(a);
|
name = seccomp_arch_to_string(a);
|
||||||
@ -47,6 +49,8 @@ static void test_seccomp_arch_to_string(void) {
|
|||||||
static void test_architecture_table(void) {
|
static void test_architecture_table(void) {
|
||||||
const char *n, *n2;
|
const char *n, *n2;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
NULSTR_FOREACH(n,
|
NULSTR_FOREACH(n,
|
||||||
"native\0"
|
"native\0"
|
||||||
"x86\0"
|
"x86\0"
|
||||||
@ -75,6 +79,8 @@ static void test_architecture_table(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_syscall_filter_set_find(void) {
|
static void test_syscall_filter_set_find(void) {
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
assert_se(!syscall_filter_set_find(NULL));
|
assert_se(!syscall_filter_set_find(NULL));
|
||||||
assert_se(!syscall_filter_set_find(""));
|
assert_se(!syscall_filter_set_find(""));
|
||||||
assert_se(!syscall_filter_set_find("quux"));
|
assert_se(!syscall_filter_set_find("quux"));
|
||||||
@ -89,6 +95,8 @@ static void test_filter_sets(void) {
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
if (!is_seccomp_available()) {
|
if (!is_seccomp_available()) {
|
||||||
log_notice("Seccomp not available, skipping %s", __func__);
|
log_notice("Seccomp not available, skipping %s", __func__);
|
||||||
return;
|
return;
|
||||||
@ -136,6 +144,8 @@ static void test_filter_sets(void) {
|
|||||||
static void test_filter_sets_ordered(void) {
|
static void test_filter_sets_ordered(void) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
/* Ensure "@default" always remains at the beginning of the list */
|
/* Ensure "@default" always remains at the beginning of the list */
|
||||||
assert_se(SYSCALL_FILTER_SET_DEFAULT == 0);
|
assert_se(SYSCALL_FILTER_SET_DEFAULT == 0);
|
||||||
assert_se(streq(syscall_filter_sets[0].name, "@default"));
|
assert_se(streq(syscall_filter_sets[0].name, "@default"));
|
||||||
@ -168,6 +178,8 @@ static void test_restrict_namespace(void) {
|
|||||||
unsigned long ul;
|
unsigned long ul;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
assert_se(namespace_flags_to_string(0, &s) == 0 && streq(s, ""));
|
assert_se(namespace_flags_to_string(0, &s) == 0 && streq(s, ""));
|
||||||
s = mfree(s);
|
s = mfree(s);
|
||||||
assert_se(namespace_flags_to_string(CLONE_NEWNS, &s) == 0 && streq(s, "mnt"));
|
assert_se(namespace_flags_to_string(CLONE_NEWNS, &s) == 0 && streq(s, "mnt"));
|
||||||
@ -262,6 +274,8 @@ static void test_restrict_namespace(void) {
|
|||||||
static void test_protect_sysctl(void) {
|
static void test_protect_sysctl(void) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
if (!is_seccomp_available()) {
|
if (!is_seccomp_available()) {
|
||||||
log_notice("Seccomp not available, skipping %s", __func__);
|
log_notice("Seccomp not available, skipping %s", __func__);
|
||||||
return;
|
return;
|
||||||
@ -302,6 +316,8 @@ static void test_protect_sysctl(void) {
|
|||||||
static void test_restrict_address_families(void) {
|
static void test_restrict_address_families(void) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
if (!is_seccomp_available()) {
|
if (!is_seccomp_available()) {
|
||||||
log_notice("Seccomp not available, skipping %s", __func__);
|
log_notice("Seccomp not available, skipping %s", __func__);
|
||||||
return;
|
return;
|
||||||
@ -389,6 +405,8 @@ static void test_restrict_address_families(void) {
|
|||||||
static void test_restrict_realtime(void) {
|
static void test_restrict_realtime(void) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
if (!is_seccomp_available()) {
|
if (!is_seccomp_available()) {
|
||||||
log_notice("Seccomp not available, skipping %s", __func__);
|
log_notice("Seccomp not available, skipping %s", __func__);
|
||||||
return;
|
return;
|
||||||
@ -434,6 +452,8 @@ static void test_restrict_realtime(void) {
|
|||||||
static void test_memory_deny_write_execute_mmap(void) {
|
static void test_memory_deny_write_execute_mmap(void) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
if (!is_seccomp_available()) {
|
if (!is_seccomp_available()) {
|
||||||
log_notice("Seccomp not available, skipping %s", __func__);
|
log_notice("Seccomp not available, skipping %s", __func__);
|
||||||
return;
|
return;
|
||||||
@ -482,6 +502,8 @@ static void test_memory_deny_write_execute_shmat(void) {
|
|||||||
int shmid;
|
int shmid;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
if (!is_seccomp_available()) {
|
if (!is_seccomp_available()) {
|
||||||
log_notice("Seccomp not available, skipping %s", __func__);
|
log_notice("Seccomp not available, skipping %s", __func__);
|
||||||
return;
|
return;
|
||||||
@ -532,6 +554,8 @@ static void test_memory_deny_write_execute_shmat(void) {
|
|||||||
static void test_restrict_archs(void) {
|
static void test_restrict_archs(void) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
if (!is_seccomp_available()) {
|
if (!is_seccomp_available()) {
|
||||||
log_notice("Seccomp not available, skipping %s", __func__);
|
log_notice("Seccomp not available, skipping %s", __func__);
|
||||||
return;
|
return;
|
||||||
@ -570,6 +594,8 @@ static void test_restrict_archs(void) {
|
|||||||
static void test_load_syscall_filter_set_raw(void) {
|
static void test_load_syscall_filter_set_raw(void) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
if (!is_seccomp_available()) {
|
if (!is_seccomp_available()) {
|
||||||
log_notice("Seccomp not available, skipping %s", __func__);
|
log_notice("Seccomp not available, skipping %s", __func__);
|
||||||
return;
|
return;
|
||||||
@ -666,6 +692,8 @@ static void test_lock_personality(void) {
|
|||||||
unsigned long current;
|
unsigned long current;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
if (!is_seccomp_available()) {
|
if (!is_seccomp_available()) {
|
||||||
log_notice("Seccomp not available, skipping %s", __func__);
|
log_notice("Seccomp not available, skipping %s", __func__);
|
||||||
return;
|
return;
|
||||||
@ -714,7 +742,6 @@ static void test_lock_personality(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
test_setup_logging(LOG_DEBUG);
|
test_setup_logging(LOG_DEBUG);
|
||||||
|
|
||||||
test_seccomp_arch_to_string();
|
test_seccomp_arch_to_string();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user