summaryrefslogtreecommitdiffstats
path: root/src/test/test-install-root.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:40 +0000
commitfc53809803cd2bc2434e312b19a18fa36776da12 (patch)
treeb4b43bd6538f51965ce32856e9c053d0f90919c8 /src/test/test-install-root.c
parentAdding upstream version 255.5. (diff)
downloadsystemd-fc53809803cd2bc2434e312b19a18fa36776da12.tar.xz
systemd-fc53809803cd2bc2434e312b19a18fa36776da12.zip
Adding upstream version 256.upstream/256
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/test-install-root.c')
-rw-r--r--src/test/test-install-root.c181
1 files changed, 97 insertions, 84 deletions
diff --git a/src/test/test-install-root.c b/src/test/test-install-root.c
index efd75b2..1e7ed27 100644
--- a/src/test/test-install-root.c
+++ b/src/test/test-install-root.c
@@ -60,9 +60,9 @@ TEST(basic_mask_and_enable) {
assert_se(unit_file_mask(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/dev/null"));
+ ASSERT_STREQ(changes[0].source, "/dev/null");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/a.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -81,16 +81,16 @@ TEST(basic_mask_and_enable) {
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/a.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) == 1);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/a.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -109,7 +109,7 @@ TEST(basic_mask_and_enable) {
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -128,9 +128,9 @@ TEST(basic_mask_and_enable) {
assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("d.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/a.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -145,10 +145,10 @@ TEST(basic_mask_and_enable) {
assert_se(n_changes == 2);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[1].source, "/usr/lib/systemd/system/a.service"));
- assert_se(streq(changes[1].path, p));
+ ASSERT_STREQ(changes[1].source, "/usr/lib/systemd/system/a.service");
+ ASSERT_STREQ(changes[1].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -186,13 +186,13 @@ TEST(basic_mask_and_enable) {
assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("f.service"), &changes, &n_changes) == 1);
assert_se(n_changes == 2);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/f.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/f.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/x.target.wants/f.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
assert_se(changes[1].type == INSTALL_CHANGE_DESTINATION_NOT_PRESENT);
p = strjoina(root, "/usr/lib/systemd/system/f.service");
- assert_se(streq(changes[1].source, p));
- assert_se(streq(changes[1].path, "x.target"));
+ ASSERT_STREQ(changes[1].source, p);
+ ASSERT_STREQ(changes[1].path, "x.target");
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -200,7 +200,7 @@ TEST(basic_mask_and_enable) {
}
TEST(linked_units) {
- const char *p, *q;
+ const char *p, *q, *s;
UnitFileState state;
InstallChange *changes = NULL;
size_t n_changes = 0, i;
@@ -224,6 +224,7 @@ TEST(linked_units) {
p = strjoina(root, "/opt/linked.service");
assert_se(write_string_file(p,
"[Install]\n"
+ "Alias=linked-alias.service\n"
"WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0);
p = strjoina(root, "/opt/linked2.service");
@@ -254,9 +255,9 @@ TEST(linked_units) {
assert_se(unit_file_link(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/opt/linked.service"));
+ ASSERT_STREQ(changes[0].source, "/opt/linked.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -267,7 +268,7 @@ TEST(linked_units) {
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -275,31 +276,41 @@ TEST(linked_units) {
/* Now, let's not just link it, but also enable it */
assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0);
- assert_se(n_changes == 2);
+ assert_se(n_changes == 3);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked.service");
q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
+ s = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked-alias.service");
for (i = 0 ; i < n_changes; i++) {
assert_se(changes[i].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[i].source, "/opt/linked.service"));
+
+ if (s && streq(changes[i].path, s))
+ /* The alias symlink should point within the search path. */
+ ASSERT_STREQ(changes[i].source, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
+ else
+ ASSERT_STREQ(changes[i].source, "/opt/linked.service");
if (p && streq(changes[i].path, p))
p = NULL;
else if (q && streq(changes[i].path, q))
q = NULL;
+ else if (s && streq(changes[i].path, s))
+ s = NULL;
else
assert_not_reached();
}
- assert_se(!p && !q);
+ assert_se(!p && !q && !s);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked.service", &state) >= 0 && state == UNIT_FILE_ENABLED);
+ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked-alias.service", &state) >= 0 && state == UNIT_FILE_ALIAS);
/* And let's unlink it again */
assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0);
- assert_se(n_changes == 2);
+ assert_se(n_changes == 3);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked.service");
q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service");
+ s = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked-alias.service");
for (i = 0; i < n_changes; i++) {
assert_se(changes[i].type == INSTALL_CHANGE_UNLINK);
@@ -307,10 +318,12 @@ TEST(linked_units) {
p = NULL;
else if (q && streq(changes[i].path, q))
q = NULL;
+ else if (s && streq(changes[i].path, s))
+ s = NULL;
else
assert_not_reached();
}
- assert_se(!p && !q);
+ assert_se(!p && !q && !s);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -322,7 +335,7 @@ TEST(linked_units) {
q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked2.service");
for (i = 0 ; i < n_changes; i++) {
assert_se(changes[i].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[i].source, "/opt/linked2.service"));
+ ASSERT_STREQ(changes[i].source, "/opt/linked2.service");
if (p && streq(changes[i].path, p))
p = NULL;
@@ -340,7 +353,7 @@ TEST(linked_units) {
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
assert_se(startswith(changes[0].path, root));
assert_se(endswith(changes[0].path, "linked3.service"));
- assert_se(streq(changes[0].source, "/opt/linked3.service"));
+ ASSERT_STREQ(changes[0].source, "/opt/linked3.service");
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
}
@@ -362,7 +375,7 @@ TEST(default) {
assert_se(unit_file_set_default(RUNTIME_SCOPE_SYSTEM, 0, root, "idontexist.target", &changes, &n_changes) == -ENOENT);
assert_se(n_changes == 1);
assert_se(changes[0].type == -ENOENT);
- assert_se(streq_ptr(changes[0].path, "idontexist.target"));
+ ASSERT_STREQ(changes[0].path, "idontexist.target");
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -371,14 +384,14 @@ TEST(default) {
assert_se(unit_file_set_default(RUNTIME_SCOPE_SYSTEM, 0, root, "test-default.target", &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/test-default-real.target"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/test-default-real.target");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR "/" SPECIAL_DEFAULT_TARGET);
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
assert_se(unit_file_get_default(RUNTIME_SCOPE_SYSTEM, root, &def) >= 0);
- assert_se(streq_ptr(def, "test-default-real.target"));
+ ASSERT_STREQ(def, "test-default-real.target");
}
TEST(add_dependency) {
@@ -401,9 +414,9 @@ TEST(add_dependency) {
assert_se(unit_file_add_dependency(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("add-dependency-test-service.service"), "add-dependency-test-target.target", UNIT_WANTS, &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/real-add-dependency-test-service.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/real-add-dependency-test-service.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/real-add-dependency-test-target.target.wants/real-add-dependency-test-service.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
}
@@ -442,9 +455,9 @@ TEST(template_enable) {
assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/template@.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@def.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -458,7 +471,7 @@ TEST(template_enable) {
assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -473,9 +486,9 @@ TEST(template_enable) {
assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/template@.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@foo.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -489,7 +502,7 @@ TEST(template_enable) {
assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -506,9 +519,9 @@ TEST(template_enable) {
assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("template-symlink@quux.service"), &changes, &n_changes) >= 0);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/template@.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@quux.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -552,9 +565,9 @@ TEST(indirect) {
assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/indirectb.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/indirectb.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/indirectb.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -566,7 +579,7 @@ TEST(indirect) {
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/indirectb.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
}
@@ -614,9 +627,9 @@ TEST(preset_and_list) {
assert_se(unit_file_preset(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/preset-yes.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/preset-yes.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -628,7 +641,7 @@ TEST(preset_and_list) {
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -654,8 +667,8 @@ TEST(preset_and_list) {
for (i = 0; i < n_changes; i++) {
if (changes[i].type == INSTALL_CHANGE_SYMLINK) {
- assert_se(streq(changes[i].source, "/usr/lib/systemd/system/preset-yes.service"));
- assert_se(streq(changes[i].path, p));
+ ASSERT_STREQ(changes[i].source, "/usr/lib/systemd/system/preset-yes.service");
+ ASSERT_STREQ(changes[i].path, p);
} else
assert_se(changes[i].type == INSTALL_CHANGE_UNLINK);
}
@@ -722,7 +735,7 @@ TEST(revert) {
assert_se(unit_file_revert(RUNTIME_SCOPE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -733,11 +746,11 @@ TEST(revert) {
assert_se(unit_file_revert(RUNTIME_SCOPE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0);
assert_se(n_changes == 2);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/xx.service.d");
assert_se(changes[1].type == INSTALL_CHANGE_UNLINK);
- assert_se(streq(changes[1].path, p));
+ ASSERT_STREQ(changes[1].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
}
@@ -773,9 +786,9 @@ TEST(preset_order) {
assert_se(unit_file_preset(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("prefix-1.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/prefix-1.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/prefix-1.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/prefix-1.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -882,12 +895,12 @@ TEST(with_dropin) {
assert_se(n_changes == 2);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-1.service"));
- assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-1.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/with-dropin-1.service");
+ ASSERT_STREQ(changes[1].source, "/usr/lib/systemd/system/with-dropin-1.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-1.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-1.service");
- assert_se(streq(changes[1].path, p));
+ ASSERT_STREQ(changes[1].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -896,12 +909,12 @@ TEST(with_dropin) {
assert_se(n_changes == 2);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service"));
- assert_se(streq(changes[1].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service"));
+ ASSERT_STREQ(changes[0].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service");
+ ASSERT_STREQ(changes[1].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-2.service");
- assert_se(streq(changes[1].path, p));
+ ASSERT_STREQ(changes[1].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -910,12 +923,12 @@ TEST(with_dropin) {
assert_se(n_changes == 2);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3.service"));
- assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-3.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/with-dropin-3.service");
+ ASSERT_STREQ(changes[1].source, "/usr/lib/systemd/system/with-dropin-3.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-3.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-3.service");
- assert_se(streq(changes[1].path, p));
+ ASSERT_STREQ(changes[1].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -924,12 +937,12 @@ TEST(with_dropin) {
assert_se(n_changes == 2);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-4a.service"));
- assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-4b.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/with-dropin-4a.service");
+ ASSERT_STREQ(changes[1].source, "/usr/lib/systemd/system/with-dropin-4b.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-4a.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-4b.service");
- assert_se(streq(changes[1].path, p));
+ ASSERT_STREQ(changes[1].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -991,12 +1004,12 @@ TEST(with_dropin_template) {
assert_se(n_changes == 2);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-1@.service"));
- assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-1@.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/with-dropin-1@.service");
+ ASSERT_STREQ(changes[1].source, "/usr/lib/systemd/system/with-dropin-1@.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-1@instance-1.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-1@instance-1.service");
- assert_se(streq(changes[1].path, p));
+ ASSERT_STREQ(changes[1].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -1004,30 +1017,30 @@ TEST(with_dropin_template) {
assert_se(n_changes == 2);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
- assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service");
+ ASSERT_STREQ(changes[1].source, "/usr/lib/systemd/system/with-dropin-2@.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2@instance-1.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/graphical.target.wants/with-dropin-2@instance-1.service");
- assert_se(streq(changes[1].path, p));
+ ASSERT_STREQ(changes[1].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2@instance-2.service"), &changes, &n_changes) == 1);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2@instance-2.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-3@.service"), &changes, &n_changes) == 1);
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
- assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3@.service"));
+ ASSERT_STREQ(changes[0].source, "/usr/lib/systemd/system/with-dropin-3@.service");
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-3@instance-2.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -1067,7 +1080,7 @@ TEST(preset_multiple_instances) {
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/foo@bar0.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -1075,7 +1088,7 @@ TEST(preset_multiple_instances) {
assert_se(n_changes == 1);
assert_se(changes[0].type == INSTALL_CHANGE_UNLINK);
p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/foo@bar0.service");
- assert_se(streq(changes[0].path, p));
+ ASSERT_STREQ(changes[0].path, p);
install_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;
@@ -1118,7 +1131,7 @@ static void verify_one(
* RequiredBy= settings, and less so for Alias=. The only case where it should happen is when we have
* an Alias=alias@.service an instantiated template template@instance. In that case the instance name
* should be propagated into the alias as alias@instance. */
- assert_se(streq_ptr(alias2, updated_name));
+ ASSERT_STREQ(alias2, updated_name);
}
TEST(verify_alias) {