tree-wide: normalize comment style
This commit is contained in:
@@ -49,7 +49,7 @@ TEST(partscan_enabled) {
|
||||
|
||||
assert_se(sd_device_enumerator_new(&e) >= 0);
|
||||
assert_se(sd_device_enumerator_allow_uninitialized(e) >= 0);
|
||||
assert_se(sd_device_enumerator_add_match_subsystem(e, "block", /* match = */ true) >= 0);
|
||||
assert_se(sd_device_enumerator_add_match_subsystem(e, "block", /* match= */ true) >= 0);
|
||||
|
||||
FOREACH_DEVICE(e, dev) {
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
|
||||
@@ -275,7 +275,7 @@ int main(int argc, char *argv[]) {
|
||||
if (r < 0)
|
||||
return log_tests_skipped_errno(r, "Failed to prepare cgroup subtree");
|
||||
|
||||
r = cg_get_path(cgroup, /* suffix = */ NULL, &controller_path);
|
||||
r = cg_get_path(cgroup, /* suffix= */ NULL, &controller_path);
|
||||
ASSERT_OK(r);
|
||||
|
||||
_cleanup_(bpf_program_freep) BPFProgram *prog = NULL;
|
||||
|
||||
@@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {
|
||||
if (!can_memlock())
|
||||
return log_tests_skipped("Can't use mlock()");
|
||||
|
||||
if (!bpf_restrict_fs_supported(/* initialize = */ true))
|
||||
if (!bpf_restrict_fs_supported(/* initialize= */ true))
|
||||
return log_tests_skipped("LSM BPF hooks are not supported");
|
||||
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
|
||||
@@ -12,7 +12,7 @@ static int intro(void) {
|
||||
if (bpffs_fd < 0)
|
||||
return log_error_errno(errno, "Failed to open '/sys/fs/bpf': %m");
|
||||
|
||||
_cleanup_close_ int token_fd = bpf_token_create(bpffs_fd, /* opts = */ NULL);
|
||||
_cleanup_close_ int token_fd = bpf_token_create(bpffs_fd, /* opts= */ NULL);
|
||||
if (token_fd < 0)
|
||||
return log_error_errno(errno, "Failed to create bpf token: %m");
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ TEST(cg_create) {
|
||||
ASSERT_TRUE(path_equal(path, test_d));
|
||||
free(path);
|
||||
|
||||
ASSERT_OK_ZERO(cg_get_path(test_d, /* suffix = */ NULL, &path));
|
||||
ASSERT_OK_ZERO(cg_get_path(test_d, /* suffix= */ NULL, &path));
|
||||
log_debug("test_d: %s", path);
|
||||
ASSERT_TRUE(path_equal(path, strjoina("/sys/fs/cgroup", test_d)));
|
||||
free(path);
|
||||
|
||||
@@ -97,7 +97,7 @@ static void test_compress_decompress(const char* label, const char* type,
|
||||
|
||||
memzero(buf, MIN(size + 1000, MAX_SIZE));
|
||||
|
||||
r = compress(text, size, buf, size, &j, /* level = */ -1);
|
||||
r = compress(text, size, buf, size, &j, /* level= */ -1);
|
||||
/* assume compression must be successful except for small or random inputs */
|
||||
assert_se(r >= 0 || (size < 2048 && r == -ENOBUFS) || streq(type, "random"));
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ _unused_ static void test_compress_decompress(
|
||||
log_info("/* testing %s %s blob compression/decompression */",
|
||||
compression, data);
|
||||
|
||||
r = compress(data, data_len, compressed, sizeof(compressed), &csize, /* level = */ -1);
|
||||
r = compress(data, data_len, compressed, sizeof(compressed), &csize, /* level= */ -1);
|
||||
if (r == -ENOBUFS) {
|
||||
log_info_errno(r, "compression failed: %m");
|
||||
assert_se(may_fail);
|
||||
@@ -110,14 +110,14 @@ _unused_ static void test_decompress_startswith(const char *compression,
|
||||
|
||||
compressed = compressed1 = malloc(BUFSIZE_1);
|
||||
assert_se(compressed1);
|
||||
r = compress(data, data_len, compressed, BUFSIZE_1, &csize, /* level = */ -1);
|
||||
r = compress(data, data_len, compressed, BUFSIZE_1, &csize, /* level= */ -1);
|
||||
if (r == -ENOBUFS) {
|
||||
log_info_errno(r, "compression failed: %m");
|
||||
assert_se(may_fail);
|
||||
|
||||
compressed = compressed2 = malloc(BUFSIZE_2);
|
||||
assert_se(compressed2);
|
||||
r = compress(data, data_len, compressed, BUFSIZE_2, &csize, /* level = */ -1);
|
||||
r = compress(data, data_len, compressed, BUFSIZE_2, &csize, /* level= */ -1);
|
||||
}
|
||||
assert_se(r >= 0);
|
||||
|
||||
@@ -149,7 +149,7 @@ _unused_ static void test_decompress_startswith_short(const char *compression,
|
||||
|
||||
log_info("/* %s with %s */", __func__, compression);
|
||||
|
||||
r = compress(TEXT, sizeof TEXT, buf, sizeof buf, &csize, /* level = */ -1);
|
||||
r = compress(TEXT, sizeof TEXT, buf, sizeof buf, &csize, /* level= */ -1);
|
||||
assert_se(r >= 0);
|
||||
|
||||
for (size_t i = 1; i < strlen(TEXT); i++) {
|
||||
|
||||
+27
-27
@@ -53,10 +53,10 @@ TEST(conf_files_list) {
|
||||
}
|
||||
|
||||
ASSERT_OK(touch(strjoina(t2, "/absolute-empty.real")));
|
||||
ASSERT_OK(symlinkat_atomic_full(strjoina(t2, "/absolute-empty.real"), AT_FDCWD, strjoina(search3, "absolute-empty.conf"), /* flags = */ 0));
|
||||
ASSERT_OK(symlinkat_atomic_full(strjoina(t2, "/absolute-empty.real"), AT_FDCWD, strjoina(search3, "absolute-empty.conf"), /* flags= */ 0));
|
||||
|
||||
ASSERT_OK(write_string_file_at(tfd2, "absolute-non-empty.real", "absolute-non-empty", WRITE_STRING_FILE_CREATE));
|
||||
ASSERT_OK(symlinkat_atomic_full(strjoina(t2, "/absolute-non-empty.real"), AT_FDCWD, strjoina(search3, "absolute-non-empty.conf"), /* flags = */ 0));
|
||||
ASSERT_OK(symlinkat_atomic_full(strjoina(t2, "/absolute-non-empty.real"), AT_FDCWD, strjoina(search3, "absolute-non-empty.conf"), /* flags= */ 0));
|
||||
|
||||
ASSERT_OK(touch(strjoina(t2, "/relative-empty.real")));
|
||||
ASSERT_OK(symlinkat_atomic_full(strjoina(t2, "/relative-empty.real"), AT_FDCWD, strjoina(search3, "relative-empty.conf"), SYMLINK_MAKE_RELATIVE));
|
||||
@@ -65,16 +65,16 @@ TEST(conf_files_list) {
|
||||
ASSERT_OK(symlinkat_atomic_full(strjoina(t2, "/relative-non-empty.real"), AT_FDCWD, strjoina(search3, "relative-non-empty.conf"), SYMLINK_MAKE_RELATIVE));
|
||||
|
||||
ASSERT_OK(touch(strjoina(t, "/absolute-empty-for-root.real")));
|
||||
ASSERT_OK(symlinkat_atomic_full("/absolute-empty-for-root.real", AT_FDCWD, strjoina(search3, "absolute-empty-for-root.conf"), /* flags = */ 0));
|
||||
ASSERT_OK(symlinkat_atomic_full("/absolute-empty-for-root.real", AT_FDCWD, strjoina(search3, "absolute-empty-for-root.conf"), /* flags= */ 0));
|
||||
|
||||
ASSERT_OK(write_string_file_at(tfd, "absolute-non-empty-for-root.real", "absolute-non-empty", WRITE_STRING_FILE_CREATE));
|
||||
ASSERT_OK(symlinkat_atomic_full("/absolute-non-empty-for-root.real", AT_FDCWD, strjoina(search3, "absolute-non-empty-for-root.conf"), /* flags = */ 0));
|
||||
ASSERT_OK(symlinkat_atomic_full("/absolute-non-empty-for-root.real", AT_FDCWD, strjoina(search3, "absolute-non-empty-for-root.conf"), /* flags= */ 0));
|
||||
|
||||
ASSERT_OK(touch(strjoina(t, "/relative-empty-for-root.real")));
|
||||
ASSERT_OK(symlinkat_atomic_full("../../../../relative-empty-for-root.real", AT_FDCWD, strjoina(search3, "relative-empty-for-root.conf"), /* flags = */ 0));
|
||||
ASSERT_OK(symlinkat_atomic_full("../../../../relative-empty-for-root.real", AT_FDCWD, strjoina(search3, "relative-empty-for-root.conf"), /* flags= */ 0));
|
||||
|
||||
ASSERT_OK(write_string_file_at(tfd, "relative-non-empty-for-root.real", "relative-non-empty", WRITE_STRING_FILE_CREATE));
|
||||
ASSERT_OK(symlinkat_atomic_full("../../../../relative-non-empty-for-root.real", AT_FDCWD, strjoina(search3, "relative-non-empty-for-root.conf"), /* flags = */ 0));
|
||||
ASSERT_OK(symlinkat_atomic_full("../../../../relative-non-empty-for-root.real", AT_FDCWD, strjoina(search3, "relative-non-empty-for-root.conf"), /* flags= */ 0));
|
||||
|
||||
search1_a = strjoina(search1, "a.conf");
|
||||
search1_b = strjoina(search1, "b.conf");
|
||||
@@ -205,19 +205,19 @@ TEST(conf_files_list) {
|
||||
result = strv_free(result);
|
||||
|
||||
/* search dir3 */
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix = */ NULL, /* root = */ NULL, CONF_FILES_FILTER_MASKED, search3));
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix= */ NULL, /* root= */ NULL, CONF_FILES_FILTER_MASKED, search3));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-non-empty.conf"),
|
||||
strjoina(search3, "relative-non-empty.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix = */ NULL, /* root = */ NULL, CONF_FILES_FILTER_MASKED_BY_EMPTY, search3));
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix= */ NULL, /* root= */ NULL, CONF_FILES_FILTER_MASKED_BY_EMPTY, search3));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-non-empty.conf"),
|
||||
strjoina(search3, "relative-non-empty.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix = */ NULL, /* root = */ NULL, CONF_FILES_FILTER_MASKED_BY_SYMLINK, search3));
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix= */ NULL, /* root= */ NULL, CONF_FILES_FILTER_MASKED_BY_SYMLINK, search3));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-empty.conf"),
|
||||
strjoina(search3, "absolute-non-empty.conf"),
|
||||
@@ -225,7 +225,7 @@ TEST(conf_files_list) {
|
||||
strjoina(search3, "relative-non-empty.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix = */ NULL, /* root = */ NULL, CONF_FILES_REGULAR, search3));
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix= */ NULL, /* root= */ NULL, CONF_FILES_REGULAR, search3));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-empty.conf"),
|
||||
strjoina(search3, "absolute-non-empty.conf"),
|
||||
@@ -233,19 +233,19 @@ TEST(conf_files_list) {
|
||||
strjoina(search3, "relative-non-empty.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix = */ NULL, t, CONF_FILES_FILTER_MASKED, "/dir3/"));
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix= */ NULL, t, CONF_FILES_FILTER_MASKED, "/dir3/"));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-non-empty-for-root.conf"),
|
||||
strjoina(search3, "relative-non-empty-for-root.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix = */ NULL, t, CONF_FILES_FILTER_MASKED_BY_EMPTY, "/dir3/"));
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix= */ NULL, t, CONF_FILES_FILTER_MASKED_BY_EMPTY, "/dir3/"));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-non-empty-for-root.conf"),
|
||||
strjoina(search3, "relative-non-empty-for-root.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix = */ NULL, t, CONF_FILES_FILTER_MASKED_BY_SYMLINK, "/dir3/"));
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix= */ NULL, t, CONF_FILES_FILTER_MASKED_BY_SYMLINK, "/dir3/"));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-empty-for-root.conf"),
|
||||
strjoina(search3, "absolute-non-empty-for-root.conf"),
|
||||
@@ -253,7 +253,7 @@ TEST(conf_files_list) {
|
||||
strjoina(search3, "relative-non-empty-for-root.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix = */ NULL, t, CONF_FILES_REGULAR, "/dir3/"));
|
||||
ASSERT_OK(conf_files_list(&result, /* suffix= */ NULL, t, CONF_FILES_REGULAR, "/dir3/"));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-empty-for-root.conf"),
|
||||
strjoina(search3, "absolute-non-empty-for-root.conf"),
|
||||
@@ -261,19 +261,19 @@ TEST(conf_files_list) {
|
||||
strjoina(search3, "relative-non-empty-for-root.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix = */ NULL, AT_FDCWD, CONF_FILES_FILTER_MASKED, search3));
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix= */ NULL, AT_FDCWD, CONF_FILES_FILTER_MASKED, search3));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-non-empty.conf"),
|
||||
strjoina(search3, "relative-non-empty.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix = */ NULL, AT_FDCWD, CONF_FILES_FILTER_MASKED_BY_EMPTY, search3));
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix= */ NULL, AT_FDCWD, CONF_FILES_FILTER_MASKED_BY_EMPTY, search3));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-non-empty.conf"),
|
||||
strjoina(search3, "relative-non-empty.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix = */ NULL, AT_FDCWD, CONF_FILES_FILTER_MASKED_BY_SYMLINK, search3));
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix= */ NULL, AT_FDCWD, CONF_FILES_FILTER_MASKED_BY_SYMLINK, search3));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-empty.conf"),
|
||||
strjoina(search3, "absolute-non-empty.conf"),
|
||||
@@ -281,7 +281,7 @@ TEST(conf_files_list) {
|
||||
strjoina(search3, "relative-non-empty.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix = */ NULL, AT_FDCWD, CONF_FILES_REGULAR, search3));
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix= */ NULL, AT_FDCWD, CONF_FILES_REGULAR, search3));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(strjoina(search3, "absolute-empty.conf"),
|
||||
strjoina(search3, "absolute-non-empty.conf"),
|
||||
@@ -289,19 +289,19 @@ TEST(conf_files_list) {
|
||||
strjoina(search3, "relative-non-empty.conf"))));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix = */ NULL, tfd, CONF_FILES_FILTER_MASKED, "/dir3/"));
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix= */ NULL, tfd, CONF_FILES_FILTER_MASKED, "/dir3/"));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE("dir3/absolute-non-empty-for-root.conf",
|
||||
"dir3/relative-non-empty-for-root.conf")));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix = */ NULL, tfd, CONF_FILES_FILTER_MASKED_BY_EMPTY, "/dir3/"));
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix= */ NULL, tfd, CONF_FILES_FILTER_MASKED_BY_EMPTY, "/dir3/"));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE("dir3/absolute-non-empty-for-root.conf",
|
||||
"dir3/relative-non-empty-for-root.conf")));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix = */ NULL, tfd, CONF_FILES_FILTER_MASKED_BY_SYMLINK, "/dir3/"));
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix= */ NULL, tfd, CONF_FILES_FILTER_MASKED_BY_SYMLINK, "/dir3/"));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE("dir3/absolute-empty-for-root.conf",
|
||||
"dir3/absolute-non-empty-for-root.conf",
|
||||
@@ -309,7 +309,7 @@ TEST(conf_files_list) {
|
||||
"dir3/relative-non-empty-for-root.conf")));
|
||||
result = strv_free(result);
|
||||
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix = */ NULL, tfd, CONF_FILES_REGULAR, "/dir3/"));
|
||||
ASSERT_OK(conf_files_list_at(&result, /* suffix= */ NULL, tfd, CONF_FILES_REGULAR, "/dir3/"));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE("dir3/absolute-empty-for-root.conf",
|
||||
"dir3/absolute-non-empty-for-root.conf",
|
||||
@@ -344,7 +344,7 @@ TEST(conf_files_list) {
|
||||
|
||||
/* with replacement */
|
||||
_cleanup_free_ char *inserted = NULL;
|
||||
ASSERT_OK(conf_files_list_with_replacement(/* root = */ NULL, STRV_MAKE(search1, search2, search3), search1_a, &result, &inserted));
|
||||
ASSERT_OK(conf_files_list_with_replacement(/* root= */ NULL, STRV_MAKE(search1, search2, search3), search1_a, &result, &inserted));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(search1_a,
|
||||
search2_aa,
|
||||
@@ -358,7 +358,7 @@ TEST(conf_files_list) {
|
||||
result = strv_free(result);
|
||||
inserted = mfree(inserted);
|
||||
|
||||
ASSERT_OK(conf_files_list_with_replacement(/* root = */ NULL, STRV_MAKE(search1, search2, search3), strjoina(t, "/dir1/aa.conf"), &result, &inserted));
|
||||
ASSERT_OK(conf_files_list_with_replacement(/* root= */ NULL, STRV_MAKE(search1, search2, search3), strjoina(t, "/dir1/aa.conf"), &result, &inserted));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(search1_a,
|
||||
strjoina(search1, "aa.conf"),
|
||||
@@ -372,7 +372,7 @@ TEST(conf_files_list) {
|
||||
result = strv_free(result);
|
||||
inserted = mfree(inserted);
|
||||
|
||||
ASSERT_OK(conf_files_list_with_replacement(/* root = */ NULL, STRV_MAKE(search1, search2, search3), strjoina(t, "/dir2/a.conf"), &result, &inserted));
|
||||
ASSERT_OK(conf_files_list_with_replacement(/* root= */ NULL, STRV_MAKE(search1, search2, search3), strjoina(t, "/dir2/a.conf"), &result, &inserted));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(search1_a,
|
||||
search2_aa,
|
||||
@@ -386,7 +386,7 @@ TEST(conf_files_list) {
|
||||
result = strv_free(result);
|
||||
inserted = mfree(inserted);
|
||||
|
||||
ASSERT_OK(conf_files_list_with_replacement(/* root = */ NULL, STRV_MAKE(search1, search2, search3), strjoina(t, "/dir4/a.conf"), &result, &inserted));
|
||||
ASSERT_OK(conf_files_list_with_replacement(/* root= */ NULL, STRV_MAKE(search1, search2, search3), strjoina(t, "/dir4/a.conf"), &result, &inserted));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(search1_a,
|
||||
search2_aa,
|
||||
@@ -400,7 +400,7 @@ TEST(conf_files_list) {
|
||||
result = strv_free(result);
|
||||
inserted = mfree(inserted);
|
||||
|
||||
ASSERT_OK(conf_files_list_with_replacement(/* root = */ NULL, STRV_MAKE(search1, search2, search3), strjoina(t, "/dir4/x.conf"), &result, &inserted));
|
||||
ASSERT_OK(conf_files_list_with_replacement(/* root= */ NULL, STRV_MAKE(search1, search2, search3), strjoina(t, "/dir4/x.conf"), &result, &inserted));
|
||||
strv_print(result);
|
||||
ASSERT_TRUE(strv_equal(result, STRV_MAKE(search1_a,
|
||||
search2_aa,
|
||||
|
||||
@@ -187,14 +187,14 @@ TEST(parse_cpu_set) {
|
||||
config_parse_cpu_set( \
|
||||
"unit", \
|
||||
"filename", \
|
||||
/* line = */ 0, \
|
||||
/* line= */ 0, \
|
||||
"[Section]", \
|
||||
/* section_line = */ 0, \
|
||||
/* section_line= */ 0, \
|
||||
"CPUAffinity", \
|
||||
/* ltype = */ 0, \
|
||||
/* ltype= */ 0, \
|
||||
str, \
|
||||
c, \
|
||||
/* userdata = */ NULL)
|
||||
/* userdata= */ NULL)
|
||||
|
||||
TEST(config_parse_cpu_set) {
|
||||
CPUSet c = {};
|
||||
|
||||
@@ -134,7 +134,7 @@ static void test_encrypt_decrypt_with(sd_id128_t mode, uid_t uid) {
|
||||
mode,
|
||||
"foo",
|
||||
/* timestamp= */ USEC_INFINITY,
|
||||
/* not_after=*/ USEC_INFINITY,
|
||||
/* not_after= */ USEC_INFINITY,
|
||||
/* tpm2_device= */ NULL,
|
||||
/* tpm2_hash_pcr_mask= */ 0,
|
||||
/* tpm2_pubkey_path= */ NULL,
|
||||
|
||||
@@ -409,8 +409,8 @@ TEST(error_catching) {
|
||||
|
||||
r = execute_directories(__func__,
|
||||
dirs, DEFAULT_TIMEOUT_USEC,
|
||||
/* callbacks = */ NULL, /* callback_args = */ NULL,
|
||||
/* argv = */ NULL, /* envp = */ NULL, /* flags = */ 0);
|
||||
/* callbacks= */ NULL, /* callback_args= */ NULL,
|
||||
/* argv= */ NULL, /* envp= */ NULL, /* flags= */ 0);
|
||||
|
||||
/* we should exit with the error code of the first script that failed */
|
||||
assert_se(r == 42);
|
||||
|
||||
@@ -265,7 +265,7 @@ static bool have_userns_privileges(void) {
|
||||
* configured to make CLONE_NEWUSER require CAP_SYS_ADMIN.
|
||||
* Additionally, AppArmor may restrict unprivileged user
|
||||
* namespace creation. */
|
||||
r = capability_bounding_set_drop(UINT64_C(1) << CAP_SYS_ADMIN, /* right_now = */ true);
|
||||
r = capability_bounding_set_drop(UINT64_C(1) << CAP_SYS_ADMIN, /* right_now= */ true);
|
||||
if (r < 0) {
|
||||
log_debug_errno(r, "Failed to drop capabilities: %m");
|
||||
_exit(2);
|
||||
@@ -1606,7 +1606,7 @@ TEST(run_tests_unprivileged) {
|
||||
ASSERT_NOT_NULL((filters = strv_copy(strv_skip(saved_argv, 1))));
|
||||
|
||||
if (prepare_ns("(test-execute-unprivileged)") == 0) {
|
||||
ASSERT_OK(capability_bounding_set_drop(0, /* right_now = */ true));
|
||||
ASSERT_OK(capability_bounding_set_drop(0, /* right_now= */ true));
|
||||
|
||||
can_unshare = false;
|
||||
run_tests(RUNTIME_SCOPE_USER, filters);
|
||||
|
||||
@@ -76,8 +76,8 @@ TEST(v4) {
|
||||
static int intro(void) {
|
||||
int r;
|
||||
|
||||
ASSERT_OK_ERRNO(setenv("SYSTEMD_FIREWALL_UTIL_NFT_TABLE_NAME", "io.systemd-test.nat", /* overwrite = */ true));
|
||||
ASSERT_OK_ERRNO(setenv("SYSTEMD_FIREWALL_UTIL_DNAT_MAP_NAME", "test_map_port_ipport", /* overwrite = */ true));
|
||||
ASSERT_OK_ERRNO(setenv("SYSTEMD_FIREWALL_UTIL_NFT_TABLE_NAME", "io.systemd-test.nat", /* overwrite= */ true));
|
||||
ASSERT_OK_ERRNO(setenv("SYSTEMD_FIREWALL_UTIL_DNAT_MAP_NAME", "test_map_port_ipport", /* overwrite= */ true));
|
||||
|
||||
r = sd_nfnl_socket_open(&nfnl);
|
||||
if (r < 0)
|
||||
|
||||
@@ -617,7 +617,7 @@ TEST(signed_integers) {
|
||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *a = NULL, *b = NULL;
|
||||
ASSERT_OK(table_to_json(t, &a));
|
||||
|
||||
table_print_json(t, /*f=*/ NULL, SD_JSON_FORMAT_NEWLINE);
|
||||
table_print_json(t, /* f= */ NULL, SD_JSON_FORMAT_NEWLINE);
|
||||
|
||||
ASSERT_OK(sd_json_build(&b,
|
||||
SD_JSON_BUILD_ARRAY(
|
||||
@@ -679,7 +679,7 @@ TEST(unsigned_integers) {
|
||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *a = NULL, *b = NULL;
|
||||
ASSERT_OK(table_to_json(t, &a));
|
||||
|
||||
table_print_json(t, /*f=*/ NULL, SD_JSON_FORMAT_NEWLINE);
|
||||
table_print_json(t, /* f= */ NULL, SD_JSON_FORMAT_NEWLINE);
|
||||
|
||||
ASSERT_OK(sd_json_build(&b,
|
||||
SD_JSON_BUILD_ARRAY(
|
||||
|
||||
@@ -58,7 +58,7 @@ TEST(safe_glob) {
|
||||
ASSERT_NOT_NULL(mkdtemp(template));
|
||||
|
||||
fn = strjoina(template, "/*");
|
||||
ASSERT_ERROR(safe_glob(fn, /* flags = */ 0, &v), ENOENT);
|
||||
ASSERT_ERROR(safe_glob(fn, /* flags= */ 0, &v), ENOENT);
|
||||
|
||||
fn2 = strjoina(template, "/.*");
|
||||
ASSERT_ERROR(safe_glob(fn2, GLOB_NOSORT|GLOB_BRACE, &v), ENOENT);
|
||||
@@ -66,7 +66,7 @@ TEST(safe_glob) {
|
||||
fname = strjoina(template, "/.foobar");
|
||||
ASSERT_OK(touch(fname));
|
||||
|
||||
ASSERT_ERROR(safe_glob(fn, /* flags = */ 0, &v), ENOENT);
|
||||
ASSERT_ERROR(safe_glob(fn, /* flags= */ 0, &v), ENOENT);
|
||||
|
||||
ASSERT_OK(safe_glob(fn2, GLOB_NOSORT|GLOB_BRACE, &v));
|
||||
ASSERT_EQ(strv_length(v), 1u);
|
||||
|
||||
@@ -94,7 +94,7 @@ static void test_unhexmem_one(const char *s, size_t l, int retval) {
|
||||
_cleanup_free_ void *mem = NULL;
|
||||
size_t len;
|
||||
|
||||
assert_se(unhexmem_full(s, l, /* secure = */ false, &mem, &len) == retval);
|
||||
assert_se(unhexmem_full(s, l, /* secure= */ false, &mem, &len) == retval);
|
||||
if (retval == 0) {
|
||||
char *answer;
|
||||
|
||||
@@ -460,7 +460,7 @@ static void test_unbase64mem_one(const char *input, const char *output, int ret)
|
||||
buffer = mfree(buffer);
|
||||
size = 0;
|
||||
|
||||
assert_se(unbase64mem_full(input, SIZE_MAX, /* secure=*/ true, &buffer, &size) == ret);
|
||||
assert_se(unbase64mem_full(input, SIZE_MAX, /* secure= */ true, &buffer, &size) == ret);
|
||||
if (ret >= 0) {
|
||||
assert_se(size == strlen(output));
|
||||
assert_se(memcmp(buffer, output, size) == 0);
|
||||
|
||||
@@ -217,7 +217,7 @@ TEST(local_addresses_with_dummy) {
|
||||
reply = sd_netlink_message_unref(reply);
|
||||
|
||||
/* Enable IPv6 for the case that it is disabled by default. */
|
||||
ASSERT_OK(sysctl_write_ip_property_boolean(AF_INET6, "test-local-addr", "disable_ipv6", false, /* shadow = */ NULL));
|
||||
ASSERT_OK(sysctl_write_ip_property_boolean(AF_INET6, "test-local-addr", "disable_ipv6", false, /* shadow= */ NULL));
|
||||
|
||||
/* Bring the interface up */
|
||||
ASSERT_OK(sd_rtnl_message_new_link(rtnl, &message, RTM_SETLINK, ifindex));
|
||||
|
||||
+3
-3
@@ -96,7 +96,7 @@ static void test_log_format_iovec_sentinel(
|
||||
|
||||
va_start(ap, format);
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||
ASSERT_OK(log_format_iovec(iovec, iovec_len, &n, /* newline_separator = */ false, ENOANO, format, ap));
|
||||
ASSERT_OK(log_format_iovec(iovec, iovec_len, &n, /* newline_separator= */ false, ENOANO, format, ap));
|
||||
REENABLE_WARNING;
|
||||
va_end(ap);
|
||||
|
||||
@@ -114,7 +114,7 @@ static void test_log_format_iovec_sentinel(
|
||||
|
||||
va_start(ap, format);
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||
ASSERT_OK(log_format_iovec(iovec, iovec_len, &n, /* newline_separator = */ true, ENOANO, format, ap));
|
||||
ASSERT_OK(log_format_iovec(iovec, iovec_len, &n, /* newline_separator= */ true, ENOANO, format, ap));
|
||||
REENABLE_WARNING;
|
||||
va_end(ap);
|
||||
|
||||
@@ -234,7 +234,7 @@ static void test_log_context(void) {
|
||||
_cleanup_(log_context_unrefp) LogContext *ctx = NULL;
|
||||
|
||||
char **strv = STRV_MAKE("SIXTH=ijn", "SEVENTH=PRP");
|
||||
ASSERT_NOT_NULL(ctx = log_context_new_strv(strv, /*owned=*/ false));
|
||||
ASSERT_NOT_NULL(ctx = log_context_new_strv(strv, /* owned= */ false));
|
||||
|
||||
ASSERT_EQ(log_context_num_contexts(), 1U);
|
||||
ASSERT_EQ(log_context_num_fields(), 2U);
|
||||
|
||||
@@ -82,7 +82,7 @@ TEST(mkdir_p_safe) {
|
||||
ASSERT_OK(mkdir_parents_safe(tmp, p, 0000, UID_INVALID, GID_INVALID, 0));
|
||||
ASSERT_OK(r = safe_fork("(test-mkdir-no-cap)", FORK_DEATHSIG_SIGTERM | FORK_WAIT | FORK_LOG, NULL));
|
||||
if (r == 0) {
|
||||
(void) capability_bounding_set_drop(0, /* right_now = */ true);
|
||||
(void) capability_bounding_set_drop(0, /* right_now= */ true);
|
||||
ASSERT_ERROR(mkdir_p_safe(tmp, p, 0000, UID_INVALID, GID_INVALID, 0), EACCES);
|
||||
_exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -94,8 +94,8 @@ TEST(notify_socket_prepare) {
|
||||
|
||||
ASSERT_OK(r = pidref_safe_fork("(test-notify-recv-child)", FORK_DEATHSIG_SIGTERM|FORK_LOG, &c.pidref));
|
||||
if (r == 0) {
|
||||
ASSERT_OK_ERRNO(setenv("NOTIFY_SOCKET", path, /* overwrite = */ true));
|
||||
ASSERT_OK_POSITIVE(sd_notify(/* unset_environment = */ false, "FIRST_MESSAGE=1"));
|
||||
ASSERT_OK_ERRNO(setenv("NOTIFY_SOCKET", path, /* overwrite= */ true));
|
||||
ASSERT_OK_POSITIVE(sd_notify(/* unset_environment= */ false, "FIRST_MESSAGE=1"));
|
||||
|
||||
_cleanup_close_ int fd1 = open("/tmp", O_RDONLY|O_CLOEXEC|O_DIRECTORY);
|
||||
ASSERT_OK_ERRNO(fd1);
|
||||
@@ -104,7 +104,7 @@ TEST(notify_socket_prepare) {
|
||||
|
||||
ASSERT_OK_POSITIVE(
|
||||
sd_pid_notify_with_fds(
|
||||
0, /* unset_environment = */ false,
|
||||
0, /* unset_environment= */ false,
|
||||
"SECOND_MESSAGE=1\nADDITIONAL_DATA=hoge", (int[]) { fd1, fd2 }, 2));
|
||||
_exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -490,18 +490,18 @@ static int run(int argc, char **argv) {
|
||||
/* Testing with several syscalls filtered, and check if the nss modules gracefully handle failures in
|
||||
* masked syscalls. See issue #38582. */
|
||||
|
||||
ASSERT_OK(r = safe_fork("(with-seccomp)", FORK_LOG | FORK_WAIT, /* ret_pid = */ NULL));
|
||||
ASSERT_OK(r = safe_fork("(with-seccomp)", FORK_LOG | FORK_WAIT, /* ret_pid= */ NULL));
|
||||
if (r == 0) {
|
||||
_cleanup_hashmap_free_ Hashmap *filter = NULL;
|
||||
ASSERT_NOT_NULL(filter = hashmap_new(NULL));
|
||||
FOREACH_STRING(s, "uname", "olduname", "oldolduname", "sigprocmask", "rt_sigprocmask", "osf_sigprocmask")
|
||||
ASSERT_OK(seccomp_filter_set_add_by_name(filter, /* add = */ true, s));
|
||||
ASSERT_OK(seccomp_load_syscall_filter_set_raw(SCMP_ACT_ALLOW, filter, SCMP_ACT_ERRNO(ENOSYS), /* log_missing = */ true));
|
||||
ASSERT_OK(seccomp_filter_set_add_by_name(filter, /* add= */ true, s));
|
||||
ASSERT_OK(seccomp_load_syscall_filter_set_raw(SCMP_ACT_ALLOW, filter, SCMP_ACT_ERRNO(ENOSYS), /* log_missing= */ true));
|
||||
|
||||
/* To make assert_return() and friends not call abort(), even built as developer mode. */
|
||||
ASSERT_OK_ERRNO(setenv("SYSTEMD_ASSERT_RETURN_IS_CRITICAL", "0", /* overwrite = */ true));
|
||||
ASSERT_OK_ERRNO(setenv("SYSTEMD_ASSERT_RETURN_IS_CRITICAL", "0", /* overwrite= */ true));
|
||||
/* Let's also make nss modules output debugging logs. */
|
||||
ASSERT_OK_ERRNO(setenv("SYSTEMD_LOG_LEVEL", "debug", /* overwrite = */ true));
|
||||
ASSERT_OK_ERRNO(setenv("SYSTEMD_LOG_LEVEL", "debug", /* overwrite= */ true));
|
||||
|
||||
STRV_FOREACH(module, modules)
|
||||
ASSERT_OK(test_one_module(dir, *module, names, addresses, n_addresses));
|
||||
|
||||
+16
-16
@@ -10,79 +10,79 @@ TEST(osc) {
|
||||
|
||||
log_info("boot");
|
||||
ASSERT_OK(osc_context_open_boot(&seq));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
ASSERT_OK(osc_context_close(SD_ID128_ALLF, &seq));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
log_info("container");
|
||||
sd_id128_t id;
|
||||
ASSERT_OK(osc_context_open_container("foobar", &seq, &id));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
ASSERT_OK(osc_context_close(id, &seq));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
log_info("vm");
|
||||
ASSERT_OK(osc_context_open_vm("foobar", &seq, &id));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
ASSERT_OK(osc_context_close(id, &seq));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
log_info("chpriv → root");
|
||||
ASSERT_OK(osc_context_open_chpriv("root", &seq, &id));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
ASSERT_OK(osc_context_close(id, &seq));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
log_info("chpriv → userxyz");
|
||||
ASSERT_OK(osc_context_open_chpriv("userxyz", &seq, &id));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
ASSERT_OK(osc_context_close(id, &seq));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
log_info("chpriv → self");
|
||||
_cleanup_free_ char *self = ASSERT_PTR(getusername_malloc());
|
||||
ASSERT_OK(osc_context_open_chpriv(self, &seq, &id));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
ASSERT_OK(osc_context_close(id, &seq));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
log_info("session");
|
||||
ASSERT_OK(osc_context_open_session("foobaruser", "session1", &seq, &id));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
ASSERT_OK(osc_context_close(id, &seq));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
log_info("service");
|
||||
sd_id128_t invocation_id;
|
||||
ASSERT_OK(sd_id128_randomize(&invocation_id));
|
||||
ASSERT_OK(osc_context_open_service("getty@tty1.service", invocation_id, &seq));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
|
||||
ASSERT_OK(osc_context_id_from_invocation_id(invocation_id, &id));
|
||||
ASSERT_OK(osc_context_close(id, &seq));
|
||||
hexdump(/* f = */ NULL, seq, SIZE_MAX);
|
||||
hexdump(/* f= */ NULL, seq, SIZE_MAX);
|
||||
seq = mfree(seq);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,20 +162,20 @@ TEST(proc_cmdline_get_bool) {
|
||||
|
||||
assert_se(putenv((char*) "SYSTEMD_PROC_CMDLINE=foo_bar bar-waldo=1 x_y-z=0 quux=miep\nda=yes\nthe=1") == 0);
|
||||
|
||||
assert_se(proc_cmdline_get_bool("", /* flags = */ 0, &value) == -EINVAL);
|
||||
assert_se(proc_cmdline_get_bool("abc", /* flags = */ 0, &value) == 0 && value == false);
|
||||
assert_se(proc_cmdline_get_bool("", /* flags= */ 0, &value) == -EINVAL);
|
||||
assert_se(proc_cmdline_get_bool("abc", /* flags= */ 0, &value) == 0 && value == false);
|
||||
assert_se(proc_cmdline_get_bool("unspecified", PROC_CMDLINE_TRUE_WHEN_MISSING, &value) == 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("foo_bar", /* flags = */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("foo-bar", /* flags = */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("bar-waldo", /* flags = */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("bar_waldo", /* flags = */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("x_y-z", /* flags = */ 0, &value) > 0 && value == false);
|
||||
assert_se(proc_cmdline_get_bool("x-y-z", /* flags = */ 0, &value) > 0 && value == false);
|
||||
assert_se(proc_cmdline_get_bool("x-y_z", /* flags = */ 0, &value) > 0 && value == false);
|
||||
assert_se(proc_cmdline_get_bool("x_y_z", /* flags = */ 0, &value) > 0 && value == false);
|
||||
assert_se(proc_cmdline_get_bool("quux", /* flags = */ 0, &value) == -EINVAL && value == false);
|
||||
assert_se(proc_cmdline_get_bool("da", /* flags = */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("the", /* flags = */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("foo_bar", /* flags= */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("foo-bar", /* flags= */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("bar-waldo", /* flags= */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("bar_waldo", /* flags= */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("x_y-z", /* flags= */ 0, &value) > 0 && value == false);
|
||||
assert_se(proc_cmdline_get_bool("x-y-z", /* flags= */ 0, &value) > 0 && value == false);
|
||||
assert_se(proc_cmdline_get_bool("x-y_z", /* flags= */ 0, &value) > 0 && value == false);
|
||||
assert_se(proc_cmdline_get_bool("x_y_z", /* flags= */ 0, &value) > 0 && value == false);
|
||||
assert_se(proc_cmdline_get_bool("quux", /* flags= */ 0, &value) == -EINVAL && value == false);
|
||||
assert_se(proc_cmdline_get_bool("da", /* flags= */ 0, &value) > 0 && value == true);
|
||||
assert_se(proc_cmdline_get_bool("the", /* flags= */ 0, &value) > 0 && value == true);
|
||||
}
|
||||
|
||||
TEST(proc_cmdline_get_key_many) {
|
||||
@@ -237,7 +237,7 @@ TEST(proc_cmdline_key_startswith) {
|
||||
\
|
||||
/* This emulates pid_get_cmdline_strv(). */ \
|
||||
assert_se(a = strv_parse_nulstr_full(s, ELEMENTSOF(s), \
|
||||
/* drop_trailing_nuls = */ true)); \
|
||||
/* drop_trailing_nuls= */ true)); \
|
||||
assert_se(proc_cmdline_filter_pid1_args(a, &b) >= 0); \
|
||||
assert_se(strv_equal(b, expected)); \
|
||||
})
|
||||
|
||||
+14
-14
@@ -176,7 +176,7 @@ TEST(syscall_filter_set_find) {
|
||||
TEST(filter_sets) {
|
||||
int r;
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
for (unsigned i = 0; i < _SYSCALL_FILTER_SET_MAX; i++) {
|
||||
|
||||
@@ -293,7 +293,7 @@ TEST(restrict_namespace) {
|
||||
assert_se(namespace_flags_from_string(s, &ul) == 0 && ul == NAMESPACE_FLAGS_ALL);
|
||||
s = mfree(s);
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
ASSERT_OK(r = safe_fork("(restrict-namespace)", FORK_LOG | FORK_WAIT, NULL));
|
||||
if (r == 0) {
|
||||
@@ -350,7 +350,7 @@ TEST(protect_sysctl) {
|
||||
int r;
|
||||
|
||||
/* in containers _sysctl() is likely missing anyway */
|
||||
CHECK_SECCOMP(/* skip_container = */ true);
|
||||
CHECK_SECCOMP(/* skip_container= */ true);
|
||||
|
||||
_cleanup_free_ char *seccomp = NULL;
|
||||
assert_se(get_proc_field("/proc/self/status", "Seccomp", &seccomp) == 0);
|
||||
@@ -386,7 +386,7 @@ TEST(protect_syslog) {
|
||||
int r;
|
||||
|
||||
/* in containers syslog() is likely missing anyway */
|
||||
CHECK_SECCOMP(/* skip_container = */ true);
|
||||
CHECK_SECCOMP(/* skip_container= */ true);
|
||||
|
||||
ASSERT_OK(r = safe_fork("(protect-syslog)", FORK_LOG | FORK_WAIT, NULL));
|
||||
if (r == 0) {
|
||||
@@ -409,7 +409,7 @@ TEST(protect_syslog) {
|
||||
TEST(restrict_address_families) {
|
||||
int r;
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
ASSERT_OK(r = safe_fork("(restrict-address-families)", FORK_LOG | FORK_WAIT, NULL));
|
||||
if (r == 0) {
|
||||
@@ -486,7 +486,7 @@ TEST(restrict_realtime) {
|
||||
int r;
|
||||
|
||||
/* in containers RT privs are likely missing anyway */
|
||||
CHECK_SECCOMP(/* skip_container = */ true);
|
||||
CHECK_SECCOMP(/* skip_container= */ true);
|
||||
|
||||
ASSERT_OK(r = safe_fork("(restrict-realtime)", FORK_LOG | FORK_WAIT, NULL));
|
||||
if (r == 0) {
|
||||
@@ -529,7 +529,7 @@ TEST(restrict_realtime) {
|
||||
TEST(memory_deny_write_execute_mmap) {
|
||||
int r;
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
#if HAVE_VALGRIND_VALGRIND_H
|
||||
if (RUNNING_ON_VALGRIND) {
|
||||
@@ -590,7 +590,7 @@ TEST(memory_deny_write_execute_shmat) {
|
||||
log_debug("arch %s: SCMP_SYS(shmdt) = %d", seccomp_arch_to_string(arch), SCMP_SYS(shmdt));
|
||||
}
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
#if HAVE_VALGRIND_VALGRIND_H
|
||||
if (RUNNING_ON_VALGRIND) {
|
||||
@@ -646,7 +646,7 @@ TEST(memory_deny_write_execute_shmat) {
|
||||
TEST(restrict_archs) {
|
||||
int r;
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
ASSERT_OK(r = safe_fork("(restrict-archs)", FORK_LOG | FORK_WAIT, NULL));
|
||||
if (r == 0) {
|
||||
@@ -673,7 +673,7 @@ TEST(restrict_archs) {
|
||||
TEST(load_syscall_filter_set_raw) {
|
||||
int r;
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
ASSERT_OK(r = safe_fork("(load-filter)", FORK_LOG | FORK_WAIT, NULL));
|
||||
if (r == 0) {
|
||||
@@ -775,7 +775,7 @@ TEST(load_syscall_filter_set_raw) {
|
||||
TEST(native_syscalls_filtered) {
|
||||
int r;
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
ASSERT_OK(r = safe_fork("(native-syscalls)", FORK_LOG | FORK_WAIT, NULL));
|
||||
if (r == 0) {
|
||||
@@ -823,7 +823,7 @@ TEST(lock_personality) {
|
||||
unsigned long current_opinionated;
|
||||
int r;
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
assert_se(opinionated_personality(¤t_opinionated) >= 0);
|
||||
|
||||
@@ -898,7 +898,7 @@ static int try_fchmodat2(int dirfd, const char *path, mode_t mode, int flags) {
|
||||
TEST(restrict_suid_sgid) {
|
||||
int r;
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
ASSERT_OK(r = safe_fork("(suid-sgid)", FORK_LOG | FORK_WAIT, NULL));
|
||||
if (r == 0) {
|
||||
@@ -1122,7 +1122,7 @@ static void test_seccomp_suppress_sync_child(void) {
|
||||
TEST(seccomp_suppress_sync) {
|
||||
int r;
|
||||
|
||||
CHECK_SECCOMP(/* skip_container = */ false);
|
||||
CHECK_SECCOMP(/* skip_container= */ false);
|
||||
|
||||
ASSERT_OK(r = safe_fork("(suppress-sync)", FORK_LOG | FORK_WAIT, NULL));
|
||||
if (r == 0) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define TRIAL 100u
|
||||
|
||||
static void set_timezone(const char *tz) {
|
||||
ASSERT_OK(set_unset_env("TZ", tz, /* overwrite = */ true));
|
||||
ASSERT_OK(set_unset_env("TZ", tz, /* overwrite= */ true));
|
||||
tzset();
|
||||
log_info("TZ=%s, tzname[0]=%s, tzname[1]=%s", strna(getenv("TZ")), strempty(get_tzname(/* dst= */ false)), strempty(get_tzname(/* dst= */ true)));
|
||||
}
|
||||
@@ -431,7 +431,7 @@ static void test_format_timestamp_impl(usec_t x) {
|
||||
usec_t y_sec = y / USEC_PER_SEC;
|
||||
|
||||
if (x_sec == y_sec && streq(xx, yy))
|
||||
return; /* Yay!*/
|
||||
return; /* Yay! */
|
||||
|
||||
/* When the timezone is built with rearguard being enabled (e.g. old Ubuntu and RHEL), the following
|
||||
* timezone may provide time shifted 1 hour from the original. See
|
||||
|
||||
+11
-11
@@ -160,11 +160,11 @@ TEST(uid_range_coalesce) {
|
||||
_cleanup_(uid_range_freep) UIDRange *p = NULL;
|
||||
|
||||
for (size_t i = 0; i < 10; i++) {
|
||||
assert_se(uid_range_add_internal(&p, i * 10, 10, /* coalesce = */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, i * 10 + 5, 10, /* coalesce = */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, i * 10, 10, /* coalesce= */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, i * 10 + 5, 10, /* coalesce= */ false) >= 0);
|
||||
}
|
||||
|
||||
assert_se(uid_range_add_internal(&p, 100, 1, /* coalesce = */ true) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, 100, 1, /* coalesce= */ true) >= 0);
|
||||
assert_se(p->n_entries == 1);
|
||||
assert_se(p->entries[0].start == 0);
|
||||
assert_se(p->entries[0].nr == 105);
|
||||
@@ -172,11 +172,11 @@ TEST(uid_range_coalesce) {
|
||||
p = uid_range_free(p);
|
||||
|
||||
for (size_t i = 0; i < 10; i++) {
|
||||
assert_se(uid_range_add_internal(&p, (10 - i) * 10, 10, /* coalesce = */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, (10 - i) * 10 + 5, 10, /* coalesce = */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, (10 - i) * 10, 10, /* coalesce= */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, (10 - i) * 10 + 5, 10, /* coalesce= */ false) >= 0);
|
||||
}
|
||||
|
||||
assert_se(uid_range_add_internal(&p, 100, 1, /* coalesce = */ true) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, 100, 1, /* coalesce= */ true) >= 0);
|
||||
assert_se(p->n_entries == 1);
|
||||
assert_se(p->entries[0].start == 10);
|
||||
assert_se(p->entries[0].nr == 105);
|
||||
@@ -184,12 +184,12 @@ TEST(uid_range_coalesce) {
|
||||
p = uid_range_free(p);
|
||||
|
||||
for (size_t i = 0; i < 10; i++) {
|
||||
assert_se(uid_range_add_internal(&p, i * 10, 10, /* coalesce = */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, i * 10 + 5, 10, /* coalesce = */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, (10 - i) * 10, 10, /* coalesce = */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, (10 - i) * 10 + 5, 10, /* coalesce = */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, i * 10, 10, /* coalesce= */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, i * 10 + 5, 10, /* coalesce= */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, (10 - i) * 10, 10, /* coalesce= */ false) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, (10 - i) * 10 + 5, 10, /* coalesce= */ false) >= 0);
|
||||
}
|
||||
assert_se(uid_range_add_internal(&p, 100, 1, /* coalesce = */ true) >= 0);
|
||||
assert_se(uid_range_add_internal(&p, 100, 1, /* coalesce= */ true) >= 0);
|
||||
assert_se(p->n_entries == 1);
|
||||
assert_se(p->entries[0].start == 0);
|
||||
assert_se(p->entries[0].nr == 115);
|
||||
|
||||
Reference in New Issue
Block a user