From fc53809803cd2bc2434e312b19a18fa36776da12 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:40 +0200 Subject: Adding upstream version 256. Signed-off-by: Daniel Baumann --- src/test/test-specifier.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/test/test-specifier.c') diff --git a/src/test/test-specifier.c b/src/test/test-specifier.c index d6a8b79..7d25969 100644 --- a/src/test/test-specifier.c +++ b/src/test/test-specifier.c @@ -16,7 +16,7 @@ static void test_specifier_escape_one(const char *a, const char *b) { _cleanup_free_ char *x = NULL; x = specifier_escape(a); - assert_se(streq_ptr(x, b)); + ASSERT_STREQ(x, b); } TEST(specifier_escape) { @@ -73,7 +73,7 @@ TEST(specifier_printf) { assert_se(w); puts(w); - assert_se(streq(w, "xxx a=AAAA b=BBBB e= yyy")); + ASSERT_STREQ(w, "xxx a=AAAA b=BBBB e= yyy"); free(w); r = specifier_printf("boot=%b, host=%H, pretty=%q, version=%v, arch=%a, empty=%e", SIZE_MAX, table, NULL, NULL, &w); @@ -107,7 +107,7 @@ TEST(specifier_real_path) { /* /dev/initctl should normally be a symlink to /run/initctl */ if (inode_same("/dev/initctl", "/run/initctl", 0) > 0) - assert_se(streq(w, "p=/dev/initctl y=/run/initctl Y=/run w=/dev/tty W=/dev")); + ASSERT_STREQ(w, "p=/dev/initctl y=/run/initctl Y=/run w=/dev/tty W=/dev"); } TEST(specifier_real_path_missing_file) { @@ -138,6 +138,8 @@ TEST(specifiers) { xsprintf(spec, "%%%c", s->specifier); r = specifier_printf(spec, SIZE_MAX, specifier_table, NULL, NULL, &resolved); + if (s->specifier == 'A' && r == -EUNATCH) /* os-release might be missing in build chroots */ + continue; if (s->specifier == 'm' && IN_SET(r, -EUNATCH, -ENOMEDIUM, -ENOPKG)) /* machine-id might be missing in build chroots */ continue; assert_se(r >= 0); @@ -176,11 +178,11 @@ TEST(specifiers_missing_data_ok) { assert_se(setenv("SYSTEMD_OS_RELEASE", "/dev/null", 1) == 0); assert_se(specifier_printf("%A-%B-%M-%o-%w-%W", SIZE_MAX, specifier_table, NULL, NULL, &resolved) >= 0); - assert_se(streq(resolved, "-----")); + ASSERT_STREQ(resolved, "-----"); assert_se(setenv("SYSTEMD_OS_RELEASE", "/nosuchfileordirectory", 1) == 0); assert_se(specifier_printf("%A-%B-%M-%o-%w-%W", SIZE_MAX, specifier_table, NULL, NULL, &resolved) == -EUNATCH); - assert_se(streq(resolved, "-----")); + ASSERT_STREQ(resolved, "-----"); assert_se(unsetenv("SYSTEMD_OS_RELEASE") == 0); } -- cgit v1.2.3