From efeb864cb547a2cbf96dc0053a8bdb4d9190b364 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:45 +0200 Subject: Merging upstream version 256. Signed-off-by: Daniel Baumann --- src/test/test-load-fragment.c | 58 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'src/test/test-load-fragment.c') diff --git a/src/test/test-load-fragment.c b/src/test/test-load-fragment.c index 8d2cec0..94904e5 100644 --- a/src/test/test-load-fragment.c +++ b/src/test/test-load-fragment.c @@ -79,12 +79,12 @@ static void check_execcommand(ExecCommand *c, n = strv_length(c->argv); log_info("actual: \"%s\" [\"%s\" \"%s\" \"%s\"]", c->path, c->argv[0], n > 0 ? c->argv[1] : "(null)", n > 1 ? c->argv[2] : "(null)"); - assert_se(streq(c->path, path)); - assert_se(streq(c->argv[0], argv0 ?: path)); + ASSERT_STREQ(c->path, path); + ASSERT_STREQ(c->argv[0], argv0 ?: path); if (n > 0) - assert_se(streq_ptr(c->argv[1], argv1)); + ASSERT_STREQ(c->argv[1], argv1); if (n > 1) - assert_se(streq_ptr(c->argv[2], argv2)); + ASSERT_STREQ(c->argv[2], argv2); assert_se(!!(c->flags & EXEC_COMMAND_IGNORE_FAILURE) == ignore); } @@ -139,7 +139,7 @@ TEST(config_parse_exec) { "LValue", 0, "/RValue/ argv0 r1", &c, u); assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* honour_argv0 */"); r = config_parse_exec(NULL, "fake", 3, "section", 1, @@ -154,14 +154,14 @@ TEST(config_parse_exec) { "LValue", 0, "@/RValue", &c, u); assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* no command, whitespace only, reset */"); r = config_parse_exec(NULL, "fake", 3, "section", 1, "LValue", 0, "", &c, u); assert_se(r == 0); - assert_se(c == NULL); + ASSERT_NULL(c); log_info("/* ignore && honour_argv0 */"); r = config_parse_exec(NULL, "fake", 4, "section", 1, @@ -184,14 +184,14 @@ TEST(config_parse_exec) { "LValue", 0, "--/RValue argv0 r1", &c, u); assert_se(r == 0); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* ignore && ignore (2) */"); r = config_parse_exec(NULL, "fake", 4, "section", 1, "LValue", 0, "-@-/RValue argv0 r1", &c, u); assert_se(r == 0); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* semicolon */"); r = config_parse_exec(NULL, "fake", 5, "section", 1, @@ -227,7 +227,7 @@ TEST(config_parse_exec) { c1 = c1->command_next; check_execcommand(c1, "/RValue", "argv0", "r1", NULL, true); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* trailing semicolon, no whitespace */"); r = config_parse_exec(NULL, "fake", 5, "section", 1, @@ -238,7 +238,7 @@ TEST(config_parse_exec) { c1 = c1->command_next; check_execcommand(c1, "/RValue", "argv0", "r1", NULL, true); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* trailing semicolon in single quotes */"); r = config_parse_exec(NULL, "fake", 5, "section", 1, @@ -366,7 +366,7 @@ TEST(config_parse_exec) { "LValue", 0, path, &c, u); assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); } log_info("/* valid character: \\s */"); @@ -392,35 +392,35 @@ TEST(config_parse_exec) { "LValue", 0, "/path\\", &c, u); assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* missing ending ' */"); r = config_parse_exec(NULL, "fake", 4, "section", 1, "LValue", 0, "/path 'foo", &c, u); assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* missing ending ' with trailing backslash */"); r = config_parse_exec(NULL, "fake", 4, "section", 1, "LValue", 0, "/path 'foo\\", &c, u); assert_se(r == -ENOEXEC); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* invalid space between modifiers */"); r = config_parse_exec(NULL, "fake", 4, "section", 1, "LValue", 0, "- /path", &c, u); assert_se(r == 0); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* only modifiers, no path */"); r = config_parse_exec(NULL, "fake", 4, "section", 1, "LValue", 0, "-", &c, u); assert_se(r == 0); - assert_se(c1->command_next == NULL); + ASSERT_NULL(c1->command_next); log_info("/* long arg */"); /* See issue #22957. */ @@ -442,7 +442,7 @@ TEST(config_parse_exec) { "LValue", 0, "", &c, u); assert_se(r == 0); - assert_se(c == NULL); + ASSERT_NULL(c); exec_command_free_list(c); } @@ -544,7 +544,7 @@ TEST(install_printf, .sd_booted = true) { memzero(i.path, strlen(i.path)); \ if (result) { \ printf("%s\n", t); \ - assert_se(streq(t, result)); \ + ASSERT_STREQ(t, result); \ } else \ assert_se(!t); \ strcpy(i.name, d1); \ @@ -794,8 +794,8 @@ TEST(config_parse_pass_environ) { &passenv, NULL); assert_se(r >= 0); assert_se(strv_length(passenv) == 2); - assert_se(streq(passenv[0], "A")); - assert_se(streq(passenv[1], "B")); + ASSERT_STREQ(passenv[0], "A"); + ASSERT_STREQ(passenv[1], "B"); r = config_parse_pass_environ(NULL, "fake", 1, "section", 1, "PassEnvironment", 0, "", @@ -808,7 +808,7 @@ TEST(config_parse_pass_environ) { &passenv, NULL); assert_se(r >= 0); assert_se(strv_length(passenv) == 1); - assert_se(streq(passenv[0], "normal_name")); + ASSERT_STREQ(passenv[0], "normal_name"); } TEST(config_parse_unit_env_file) { @@ -858,8 +858,8 @@ TEST(config_parse_unit_env_file) { &files, u); assert_se(r == 0); assert_se(strv_length(files) == 2); - assert_se(streq(files[0], "/absolute1")); - assert_se(streq(files[1], "/absolute2")); + ASSERT_STREQ(files[0], "/absolute1"); + ASSERT_STREQ(files[1], "/absolute2"); r = config_parse_unit_env_file(u->id, "fake", 1, "section", 1, "EnvironmentFile", 0, "", @@ -872,7 +872,7 @@ TEST(config_parse_unit_env_file) { &files, u); assert_se(r == 0); assert_se(strv_length(files) == 1); - assert_se(streq(files[0], "/path/foobar.service.conf")); + ASSERT_STREQ(files[0], "/path/foobar.service.conf"); } TEST(unit_dump_config_items) { @@ -1073,8 +1073,8 @@ TEST(config_parse_open_file) { &of, u); assert_se(r >= 0); assert_se(of); - assert_se(streq(of->path, "/proc/1/ns/mnt")); - assert_se(streq(of->fdname, "host-mount-namespace")); + ASSERT_STREQ(of->path, "/proc/1/ns/mnt"); + ASSERT_STREQ(of->fdname, "host-mount-namespace"); assert_se(of->flags == OPENFILE_READ_ONLY); of = open_file_free(of); @@ -1083,8 +1083,8 @@ TEST(config_parse_open_file) { &of, u); assert_se(r >= 0); assert_se(of); - assert_se(streq(of->path, "/proc/1/ns/mnt")); - assert_se(streq(of->fdname, "mnt")); + ASSERT_STREQ(of->path, "/proc/1/ns/mnt"); + ASSERT_STREQ(of->fdname, "mnt"); assert_se(of->flags == OPENFILE_READ_ONLY); r = config_parse_open_file(NULL, "fake", 1, "section", 1, -- cgit v1.2.3