]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/test/test-unit-name.c
udev: gracefully handle ENODEV or friends in opening device node
[thirdparty/systemd.git] / src / test / test-unit-name.c
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
b0193f1c 2
6553db60 3#include <fnmatch.h>
b0193f1c 4#include <stdio.h>
4f18ff2e 5#include <unistd.h>
b0193f1c 6
fa34123c 7#include "sd-daemon.h"
a635b627
NR
8#include "sd-id128.h"
9
57b7a260 10#include "all-units.h"
1cf40697 11#include "alloc-util.h"
fa34123c 12#include "fd-util.h"
ca78ad1d 13#include "format-util.h"
1cf40697 14#include "glob-util.h"
98b7c5e2 15#include "hostname-setup.h"
1682ff60 16#include "manager.h"
07630cea 17#include "path-util.h"
a04efff8 18#include "rm-rf.h"
e5af6e0e 19#include "special.h"
07630cea
LP
20#include "specifier.h"
21#include "string-util.h"
a04efff8 22#include "tests.h"
8b4679a6 23#include "tmpfile-util.h"
1cf40697 24#include "unit.h"
b4152e9b 25#include "unit-def.h"
b0193f1c 26#include "unit-name.h"
1682ff60 27#include "unit-printf.h"
79413b67 28#include "user-util.h"
b0193f1c 29
99839c7e
LP
30static char *runtime_dir = NULL;
31
32STATIC_DESTRUCTOR_REGISTER(runtime_dir, rm_rf_physical_and_freep);
33
c86ebcf3
ZJS
34static void test_unit_name_is_valid_one(const char *name, UnitNameFlags flags, bool expected) {
35 log_info("%s ( %s%s%s ): %s",
36 name,
37 (flags & UNIT_NAME_PLAIN) ? "plain" : "",
38 (flags & UNIT_NAME_INSTANCE) ? " instance" : "",
39 (flags & UNIT_NAME_TEMPLATE) ? " template" : "",
40 yes_no(expected));
41 assert_se(unit_name_is_valid(name, flags) == expected);
42}
43
26e555cb 44TEST(unit_name_is_valid) {
c86ebcf3
ZJS
45 test_unit_name_is_valid_one("foo.service", UNIT_NAME_ANY, true);
46 test_unit_name_is_valid_one("foo.service", UNIT_NAME_PLAIN, true);
47 test_unit_name_is_valid_one("foo.service", UNIT_NAME_INSTANCE, false);
48 test_unit_name_is_valid_one("foo.service", UNIT_NAME_TEMPLATE, false);
49 test_unit_name_is_valid_one("foo.service", UNIT_NAME_INSTANCE|UNIT_NAME_TEMPLATE, false);
50
51 test_unit_name_is_valid_one("foo@bar.service", UNIT_NAME_ANY, true);
52 test_unit_name_is_valid_one("foo@bar.service", UNIT_NAME_PLAIN, false);
53 test_unit_name_is_valid_one("foo@bar.service", UNIT_NAME_INSTANCE, true);
54 test_unit_name_is_valid_one("foo@bar.service", UNIT_NAME_TEMPLATE, false);
55 test_unit_name_is_valid_one("foo@bar.service", UNIT_NAME_INSTANCE|UNIT_NAME_TEMPLATE, true);
56
57 test_unit_name_is_valid_one("foo@bar@bar.service", UNIT_NAME_ANY, true);
58 test_unit_name_is_valid_one("foo@bar@bar.service", UNIT_NAME_PLAIN, false);
59 test_unit_name_is_valid_one("foo@bar@bar.service", UNIT_NAME_INSTANCE, true);
60 test_unit_name_is_valid_one("foo@bar@bar.service", UNIT_NAME_TEMPLATE, false);
61 test_unit_name_is_valid_one("foo@bar@bar.service", UNIT_NAME_INSTANCE|UNIT_NAME_TEMPLATE, true);
62
63 test_unit_name_is_valid_one("foo@.service", UNIT_NAME_ANY, true);
64 test_unit_name_is_valid_one("foo@.service", UNIT_NAME_PLAIN, false);
65 test_unit_name_is_valid_one("foo@.service", UNIT_NAME_INSTANCE, false);
66 test_unit_name_is_valid_one("foo@.service", UNIT_NAME_TEMPLATE, true);
67 test_unit_name_is_valid_one("foo@.service", UNIT_NAME_INSTANCE|UNIT_NAME_TEMPLATE, true);
68 test_unit_name_is_valid_one(".test.service", UNIT_NAME_PLAIN, true);
69 test_unit_name_is_valid_one(".test@.service", UNIT_NAME_TEMPLATE, true);
70 test_unit_name_is_valid_one("_strange::::.service", UNIT_NAME_ANY, true);
71
72 test_unit_name_is_valid_one(".service", UNIT_NAME_ANY, false);
73 test_unit_name_is_valid_one("", UNIT_NAME_ANY, false);
74 test_unit_name_is_valid_one("foo.waldo", UNIT_NAME_ANY, false);
75 test_unit_name_is_valid_one("@.service", UNIT_NAME_ANY, false);
76 test_unit_name_is_valid_one("@piep.service", UNIT_NAME_ANY, false);
77
78 test_unit_name_is_valid_one("user@1000.slice", UNIT_NAME_ANY, true);
79 test_unit_name_is_valid_one("user@1000.slice", UNIT_NAME_INSTANCE, true);
80 test_unit_name_is_valid_one("user@1000.slice", UNIT_NAME_TEMPLATE, false);
642f41a4
ZJS
81
82 test_unit_name_is_valid_one("foo@%i.service", UNIT_NAME_ANY, false);
83 test_unit_name_is_valid_one("foo@%i.service", UNIT_NAME_INSTANCE, false);
84 test_unit_name_is_valid_one("foo@%%i.service", UNIT_NAME_INSTANCE, false);
85 test_unit_name_is_valid_one("foo@%%i%f.service", UNIT_NAME_INSTANCE, false);
86 test_unit_name_is_valid_one("foo@%F.service", UNIT_NAME_INSTANCE, false);
f9ef25a4
ZJS
87
88 test_unit_name_is_valid_one("foo.target.wants/plain.service", UNIT_NAME_ANY, false);
89 test_unit_name_is_valid_one("foo.target.conf/foo.conf", UNIT_NAME_ANY, false);
90 test_unit_name_is_valid_one("foo.target.requires/plain.socket", UNIT_NAME_ANY, false);
7410616c 91}
3251c0d2 92
21868586 93static void test_unit_name_replace_instance_one(const char *pattern, const char *repl, const char *expected, int ret) {
7410616c
LP
94 _cleanup_free_ char *t = NULL;
95 assert_se(unit_name_replace_instance(pattern, repl, &t) == ret);
96 puts(strna(t));
c79e88b3 97 ASSERT_STREQ(t, expected);
7410616c 98}
3251c0d2 99
26e555cb 100TEST(unit_name_replace_instance) {
21868586
LP
101 test_unit_name_replace_instance_one("foo@.service", "waldo", "foo@waldo.service", 0);
102 test_unit_name_replace_instance_one("foo@xyz.service", "waldo", "foo@waldo.service", 0);
103 test_unit_name_replace_instance_one("xyz", "waldo", NULL, -EINVAL);
104 test_unit_name_replace_instance_one("", "waldo", NULL, -EINVAL);
105 test_unit_name_replace_instance_one("foo.service", "waldo", NULL, -EINVAL);
106 test_unit_name_replace_instance_one(".service", "waldo", NULL, -EINVAL);
107 test_unit_name_replace_instance_one("foo@", "waldo", NULL, -EINVAL);
108 test_unit_name_replace_instance_one("@bar", "waldo", NULL, -EINVAL);
7410616c 109}
3251c0d2 110
21868586 111static void test_unit_name_from_path_one(const char *path, const char *suffix, const char *expected, int ret) {
7410616c 112 _cleanup_free_ char *t = NULL;
1d0727e7 113 int r;
3251c0d2 114
7410616c
LP
115 assert_se(unit_name_from_path(path, suffix, &t) == ret);
116 puts(strna(t));
c79e88b3 117 ASSERT_STREQ(t, expected);
3251c0d2 118
7410616c
LP
119 if (t) {
120 _cleanup_free_ char *k = NULL;
1d0727e7
MS
121
122 /* We don't support converting hashed unit names back to paths */
123 r = unit_name_to_path(t, &k);
124 if (r == -ENAMETOOLONG)
125 return;
126 assert(r == 0);
127
7410616c 128 puts(strna(k));
945403e6 129 assert_se(path_equal(k, empty_to_root(path)));
7410616c
LP
130 }
131}
3251c0d2 132
1d0727e7
MS
133TEST(unit_name_is_hashed) {
134 assert_se(!unit_name_is_hashed(""));
135 assert_se(!unit_name_is_hashed("foo@bar.service"));
136 assert_se(!unit_name_is_hashed("foo@.service"));
137 assert_se(unit_name_is_hashed("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_7736d9ed33c2ec55.mount"));
138 assert_se(!unit_name_is_hashed("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_7736D9ED33C2EC55.mount"));
139 assert_se(!unit_name_is_hashed("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!7736d9ed33c2ec55.mount"));
140 assert_se(!unit_name_is_hashed("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_7736d9gd33c2ec55.mount"));
141 assert_se(!unit_name_is_hashed("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_.mount"));
142 assert_se(!unit_name_is_hashed("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_2103e1466b87f7f7@waldo.mount"));
143 assert_se(!unit_name_is_hashed("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_2103e1466b87f7f7@.mount"));
144}
145
26e555cb 146TEST(unit_name_from_path) {
21868586
LP
147 test_unit_name_from_path_one("/waldo", ".mount", "waldo.mount", 0);
148 test_unit_name_from_path_one("/waldo/quuix", ".mount", "waldo-quuix.mount", 0);
149 test_unit_name_from_path_one("/waldo/quuix/", ".mount", "waldo-quuix.mount", 0);
150 test_unit_name_from_path_one("", ".mount", "-.mount", 0);
151 test_unit_name_from_path_one("/", ".mount", "-.mount", 0);
152 test_unit_name_from_path_one("///", ".mount", "-.mount", 0);
153 test_unit_name_from_path_one("/foo/../bar", ".mount", NULL, -EINVAL);
4ff361cc 154 test_unit_name_from_path_one("/foo/./bar", ".mount", "foo-bar.mount", 0);
1d0727e7
MS
155 test_unit_name_from_path_one("/waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", ".mount",
156 "waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_7736d9ed33c2ec55.mount", 0);
7410616c
LP
157}
158
21868586 159static void test_unit_name_from_path_instance_one(const char *pattern, const char *path, const char *suffix, const char *expected, int ret) {
7410616c
LP
160 _cleanup_free_ char *t = NULL;
161
162 assert_se(unit_name_from_path_instance(pattern, path, suffix, &t) == ret);
163 puts(strna(t));
c79e88b3 164 ASSERT_STREQ(t, expected);
7410616c
LP
165
166 if (t) {
167 _cleanup_free_ char *k = NULL, *v = NULL;
168
169 assert_se(unit_name_to_instance(t, &k) > 0);
170 assert_se(unit_name_path_unescape(k, &v) == 0);
945403e6 171 assert_se(path_equal(v, empty_to_root(path)));
3251c0d2 172 }
7410616c 173}
3251c0d2 174
26e555cb 175TEST(unit_name_from_path_instance) {
21868586
LP
176 test_unit_name_from_path_instance_one("waldo", "/waldo", ".mount", "waldo@waldo.mount", 0);
177 test_unit_name_from_path_instance_one("waldo", "/waldo////quuix////", ".mount", "waldo@waldo-quuix.mount", 0);
178 test_unit_name_from_path_instance_one("waldo", "/", ".mount", "waldo@-.mount", 0);
179 test_unit_name_from_path_instance_one("waldo", "", ".mount", "waldo@-.mount", 0);
180 test_unit_name_from_path_instance_one("waldo", "///", ".mount", "waldo@-.mount", 0);
181 test_unit_name_from_path_instance_one("waldo", "..", ".mount", NULL, -EINVAL);
182 test_unit_name_from_path_instance_one("waldo", "/foo", ".waldi", NULL, -EINVAL);
183 test_unit_name_from_path_instance_one("wa--ldo", "/--", ".mount", "wa--ldo@\\x2d\\x2d.mount", 0);
7410616c
LP
184}
185
21868586 186static void test_unit_name_to_path_one(const char *unit, const char *path, int ret) {
7410616c
LP
187 _cleanup_free_ char *p = NULL;
188
189 assert_se(unit_name_to_path(unit, &p) == ret);
c79e88b3 190 ASSERT_STREQ(path, p);
7410616c
LP
191}
192
26e555cb 193TEST(unit_name_to_path) {
21868586
LP
194 test_unit_name_to_path_one("home.mount", "/home", 0);
195 test_unit_name_to_path_one("home-lennart.mount", "/home/lennart", 0);
196 test_unit_name_to_path_one("home-lennart-.mount", NULL, -EINVAL);
197 test_unit_name_to_path_one("-home-lennart.mount", NULL, -EINVAL);
198 test_unit_name_to_path_one("-home--lennart.mount", NULL, -EINVAL);
199 test_unit_name_to_path_one("home-..-lennart.mount", NULL, -EINVAL);
200 test_unit_name_to_path_one("", NULL, -EINVAL);
201 test_unit_name_to_path_one("home/foo", NULL, -EINVAL);
7410616c
LP
202}
203
37cbc1d5 204static void test_unit_name_mangle_one(bool allow_globs, const char *pattern, const char *expect, int ret) {
7410616c 205 _cleanup_free_ char *t = NULL;
5342eb46
ZJS
206 int r;
207
208 r = unit_name_mangle(pattern, (allow_globs * UNIT_NAME_MANGLE_GLOB) | UNIT_NAME_MANGLE_WARN, &t);
209 log_debug("%s: %s -> %d, %s", __func__, pattern, r, strnull(t));
7410616c 210
5342eb46 211 assert_se(r == ret);
7410616c 212 puts(strna(t));
c79e88b3 213 ASSERT_STREQ(t, expect);
7410616c
LP
214
215 if (t) {
216 _cleanup_free_ char *k = NULL;
217
2aaafcf5 218 assert_se(unit_name_is_valid(t, UNIT_NAME_ANY) ||
37cbc1d5 219 (allow_globs && string_is_glob(t)));
7410616c 220
37cbc1d5 221 assert_se(unit_name_mangle(t, (allow_globs * UNIT_NAME_MANGLE_GLOB) | UNIT_NAME_MANGLE_WARN, &k) == 0);
c79e88b3 222 ASSERT_STREQ(t, k);
7410616c
LP
223 }
224}
225
26e555cb 226TEST(unit_name_mangle) {
37cbc1d5
ZJS
227 test_unit_name_mangle_one(false, "foo.service", "foo.service", 0);
228 test_unit_name_mangle_one(false, "/home", "home.mount", 1);
229 test_unit_name_mangle_one(false, "/dev/sda", "dev-sda.device", 1);
230 test_unit_name_mangle_one(false, "üxknürz.service", "\\xc3\\xbcxkn\\xc3\\xbcrz.service", 1);
231 test_unit_name_mangle_one(false, "foobar-meh...waldi.service", "foobar-meh...waldi.service", 0);
232 test_unit_name_mangle_one(false, "_____####----.....service", "_____\\x23\\x23\\x23\\x23----.....service", 1);
233 test_unit_name_mangle_one(false, "_____##@;;;,,,##----.....service", "_____\\x23\\x23@\\x3b\\x3b\\x3b\\x2c\\x2c\\x2c\\x23\\x23----.....service", 1);
234 test_unit_name_mangle_one(false, "xxx@@@@/////\\\\\\\\\\yyy.service", "xxx@@@@-----\\\\\\\\\\yyy.service", 1);
235 test_unit_name_mangle_one(false, "", NULL, -EINVAL);
236
237 test_unit_name_mangle_one(true, "foo.service", "foo.service", 0);
238 test_unit_name_mangle_one(true, "foo", "foo.service", 1);
239 test_unit_name_mangle_one(true, "foo*", "foo*", 0);
240 test_unit_name_mangle_one(true, "ü*", "\\xc3\\xbc*", 1);
1682ff60
ZJS
241}
242
5342eb46
ZJS
243static void test_unit_name_mangle_with_suffix_one(const char *arg, int expected, const char *expected_name) {
244 _cleanup_free_ char *s = NULL;
245 int r;
246
247 r = unit_name_mangle_with_suffix(arg, NULL, 0, ".service", &s);
248 log_debug("%s: %s -> %d, %s", __func__, arg, r, strnull(s));
249
250 assert_se(r == expected);
c79e88b3 251 ASSERT_STREQ(s, expected_name);
5342eb46
ZJS
252}
253
254TEST(unit_name_mangle_with_suffix) {
255 test_unit_name_mangle_with_suffix_one("", -EINVAL, NULL);
256
257 test_unit_name_mangle_with_suffix_one("/dev", 1, "dev.mount");
258 test_unit_name_mangle_with_suffix_one("/../dev", 1, "dev.mount");
259 test_unit_name_mangle_with_suffix_one("/../dev/.", 1, "dev.mount");
260 /* We don't skip the last '..', and it makes this an invalid device or mount name */
261 test_unit_name_mangle_with_suffix_one("/.././dev/..", 1, "-..-.-dev-...service");
262 test_unit_name_mangle_with_suffix_one("/.././dev", 1, "dev.mount");
263 test_unit_name_mangle_with_suffix_one("/./.././../dev/", 1, "dev.mount");
264
265 test_unit_name_mangle_with_suffix_one("/dev/sda", 1, "dev-sda.device");
266 test_unit_name_mangle_with_suffix_one("/dev/sda5", 1, "dev-sda5.device");
267
268 test_unit_name_mangle_with_suffix_one("/sys", 1, "sys.mount");
269 test_unit_name_mangle_with_suffix_one("/../sys", 1, "sys.mount");
270 test_unit_name_mangle_with_suffix_one("/../sys/.", 1, "sys.mount");
271 /* We don't skip the last '..', and it makes this an invalid device or mount name */
272 test_unit_name_mangle_with_suffix_one("/.././sys/..", 1, "-..-.-sys-...service");
273 test_unit_name_mangle_with_suffix_one("/.././sys", 1, "sys.mount");
274 test_unit_name_mangle_with_suffix_one("/./.././../sys/", 1, "sys.mount");
275
276 test_unit_name_mangle_with_suffix_one("/proc", 1, "proc.mount");
277 test_unit_name_mangle_with_suffix_one("/../proc", 1, "proc.mount");
278 test_unit_name_mangle_with_suffix_one("/../proc/.", 1, "proc.mount");
279 /* We don't skip the last '..', and it makes this an invalid device or mount name */
280 test_unit_name_mangle_with_suffix_one("/.././proc/..", 1, "-..-.-proc-...service");
281 test_unit_name_mangle_with_suffix_one("/.././proc", 1, "proc.mount");
282 test_unit_name_mangle_with_suffix_one("/./.././../proc/", 1, "proc.mount");
283}
284
26e555cb 285TEST_RET(unit_printf, .sd_booted = true) {
8b4679a6 286 _cleanup_free_ char
4200134c 287 *architecture, *os_image_version, *boot_id = NULL, *os_build_id,
8b4679a6 288 *hostname, *short_hostname, *pretty_hostname,
4200134c 289 *machine_id = NULL, *os_image_id, *os_id, *os_version_id, *os_variant_id,
8b4679a6
ZJS
290 *user, *group, *uid, *gid, *home, *shell,
291 *tmp_dir, *var_tmp_dir;
c70cac54 292 _cleanup_(manager_freep) Manager *m = NULL;
36f73b6c 293 _cleanup_close_ int fd = -EBADF;
250e9fad 294 Unit *u;
c5e33bf8 295 int r;
1682ff60 296
8b4679a6 297 _cleanup_(unlink_tempfilep) char filename[] = "/tmp/test-unit_printf.XXXXXX";
36f73b6c
YW
298 fd = mkostemp_safe(filename);
299 assert_se(fd >= 0);
8b4679a6
ZJS
300
301 /* Using the specifier functions is admittedly a bit circular, but we don't want to reimplement the
302 * logic a second time. We're at least testing that the hookup works. */
303 assert_se(specifier_architecture('a', NULL, NULL, NULL, &architecture) >= 0);
304 assert_se(architecture);
305 assert_se(specifier_os_image_version('A', NULL, NULL, NULL, &os_image_version) >= 0);
4200134c
LB
306 if (sd_booted() > 0) {
307 assert_se(specifier_boot_id('b', NULL, NULL, NULL, &boot_id) >= 0);
308 assert_se(boot_id);
309 }
8b4679a6
ZJS
310 assert_se(specifier_os_build_id('B', NULL, NULL, NULL, &os_build_id) >= 0);
311 assert_se(hostname = gethostname_malloc());
9a5893e9 312 assert_se(specifier_short_hostname('l', NULL, NULL, NULL, &short_hostname) == 0);
8b4679a6 313 assert_se(short_hostname);
9a5893e9 314 assert_se(specifier_pretty_hostname('q', NULL, NULL, NULL, &pretty_hostname) == 0);
8b4679a6 315 assert_se(pretty_hostname);
a635b627 316 if (sd_id128_get_machine(NULL) >= 0) {
4200134c
LB
317 assert_se(specifier_machine_id('m', NULL, NULL, NULL, &machine_id) >= 0);
318 assert_se(machine_id);
319 }
8b4679a6
ZJS
320 assert_se(specifier_os_image_id('M', NULL, NULL, NULL, &os_image_id) >= 0);
321 assert_se(specifier_os_id('o', NULL, NULL, NULL, &os_id) >= 0);
322 assert_se(specifier_os_version_id('w', NULL, NULL, NULL, &os_version_id) >= 0);
323 assert_se(specifier_os_variant_id('W', NULL, NULL, NULL, &os_variant_id) >= 0);
36444d22 324 assert_se(user = uid_to_name(getuid()));
b75f0c69 325 assert_se(group = gid_to_name(getgid()));
79413b67 326 assert_se(asprintf(&uid, UID_FMT, getuid()));
b75f0c69 327 assert_se(asprintf(&gid, UID_FMT, getgid()));
79413b67
LP
328 assert_se(get_home_dir(&home) >= 0);
329 assert_se(get_shell(&shell) >= 0);
8b4679a6
ZJS
330 assert_se(specifier_tmp_dir('T', NULL, NULL, NULL, &tmp_dir) >= 0);
331 assert_se(tmp_dir);
332 assert_se(specifier_var_tmp_dir('V', NULL, NULL, NULL, &var_tmp_dir) >= 0);
333 assert_se(var_tmp_dir);
1682ff60 334
4870133b 335 r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m);
5eecb103 336 if (manager_errno_skip_test(r))
730d989a 337 return log_tests_skipped_errno(r, "manager_new");
bdf7026e 338 assert_se(r == 0);
1682ff60 339
8b4679a6
ZJS
340 assert_se(free_and_strdup(&m->cgroup_root, "/cgroup-root") == 1);
341
342#define expect(unit, pattern, _expected) \
1682ff60 343 { \
e1ba963f 344 _cleanup_free_ char *t = NULL; \
19f6d710 345 assert_se(unit_full_printf(unit, pattern, &t) >= 0); \
8b4679a6
ZJS
346 const char *expected = strempty(_expected); \
347 printf("%s: result: %s\n expect: %s\n", pattern, t, expected); \
348 assert_se(fnmatch(expected, t, FNM_NOESCAPE) == 0); \
1682ff60
ZJS
349 }
350
1682ff60
ZJS
351 assert_se(u = unit_new(m, sizeof(Service)));
352 assert_se(unit_add_name(u, "blah.service") == 0);
353 assert_se(unit_add_name(u, "blah.service") == 0);
354
8b4679a6
ZJS
355 /* We need *a* file that exists, but it doesn't even need to have the right suffix. */
356 assert_se(free_and_strdup(&u->fragment_path, filename) == 1);
357
358 /* This sets the slice to /app.slice. */
359 assert_se(unit_set_default_slice(u) == 1);
360
1682ff60
ZJS
361 /* general tests */
362 expect(u, "%%", "%");
363 expect(u, "%%s", "%s");
038492ae
FS
364 expect(u, "%,", "%,");
365 expect(u, "%", "%");
1682ff60
ZJS
366
367 /* normal unit */
8b4679a6
ZJS
368 expect(u, "%a", architecture);
369 expect(u, "%A", os_image_version);
4200134c
LB
370 if (boot_id)
371 expect(u, "%b", boot_id);
8b4679a6
ZJS
372 expect(u, "%B", os_build_id);
373 expect(u, "%H", hostname);
374 expect(u, "%l", short_hostname);
375 expect(u, "%q", pretty_hostname);
4200134c
LB
376 if (machine_id)
377 expect(u, "%m", machine_id);
8b4679a6
ZJS
378 expect(u, "%M", os_image_id);
379 expect(u, "%o", os_id);
380 expect(u, "%w", os_version_id);
381 expect(u, "%W", os_variant_id);
b75f0c69
DC
382 expect(u, "%g", group);
383 expect(u, "%G", gid);
79413b67
LP
384 expect(u, "%u", user);
385 expect(u, "%U", uid);
8b4679a6
ZJS
386 expect(u, "%T", tmp_dir);
387 expect(u, "%V", var_tmp_dir);
388
389 expect(u, "%i", "");
390 expect(u, "%I", "");
391 expect(u, "%j", "blah");
392 expect(u, "%J", "blah");
393 expect(u, "%n", "blah.service");
394 expect(u, "%N", "blah");
395 expect(u, "%p", "blah");
396 expect(u, "%P", "blah");
397 expect(u, "%f", "/blah");
398 expect(u, "%y", filename);
399 expect(u, "%Y", "/tmp");
400 expect(u, "%C", m->prefix[EXEC_DIRECTORY_CACHE]);
401 expect(u, "%d", "*/credentials/blah.service");
402 expect(u, "%E", m->prefix[EXEC_DIRECTORY_CONFIGURATION]);
403 expect(u, "%L", m->prefix[EXEC_DIRECTORY_LOGS]);
404 expect(u, "%S", m->prefix[EXEC_DIRECTORY_STATE]);
405 expect(u, "%t", m->prefix[EXEC_DIRECTORY_RUNTIME]);
79413b67 406 expect(u, "%h", home);
8b4679a6
ZJS
407 expect(u, "%s", shell);
408
409 /* deprecated */
410 expect(u, "%c", "/cgroup-root/app.slice/blah.service");
411 expect(u, "%r", "/cgroup-root/app.slice");
412 expect(u, "%R", "/cgroup-root");
1682ff60
ZJS
413
414 /* templated */
250e9fad
ZJS
415 assert_se(u = unit_new(m, sizeof(Service)));
416 assert_se(unit_add_name(u, "blah@foo-foo.service") == 0);
417 assert_se(unit_add_name(u, "blah@foo-foo.service") == 0);
418
8b4679a6
ZJS
419 assert_se(free_and_strdup(&u->fragment_path, filename) == 1);
420
421 /* This sets the slice to /app.slice/app-blah.slice. */
422 assert_se(unit_set_default_slice(u) == 1);
423
250e9fad
ZJS
424 expect(u, "%i", "foo-foo");
425 expect(u, "%I", "foo/foo");
426 expect(u, "%j", "blah");
427 expect(u, "%J", "blah");
8b4679a6
ZJS
428 expect(u, "%n", "blah@foo-foo.service");
429 expect(u, "%N", "blah@foo-foo");
430 expect(u, "%p", "blah");
431 expect(u, "%P", "blah");
432 expect(u, "%f", "/foo/foo");
433 expect(u, "%y", filename);
434 expect(u, "%Y", "/tmp");
435 expect(u, "%C", m->prefix[EXEC_DIRECTORY_CACHE]);
436 expect(u, "%d", "*/credentials/blah@foo-foo.service");
437 expect(u, "%E", m->prefix[EXEC_DIRECTORY_CONFIGURATION]);
438 expect(u, "%L", m->prefix[EXEC_DIRECTORY_LOGS]);
439 expect(u, "%S", m->prefix[EXEC_DIRECTORY_STATE]);
440 expect(u, "%t", m->prefix[EXEC_DIRECTORY_RUNTIME]);
250e9fad 441 expect(u, "%h", home);
8b4679a6
ZJS
442 expect(u, "%s", shell);
443
444 /* deprecated */
445 expect(u, "%c", "/cgroup-root/app.slice/app-blah.slice/blah@foo-foo.service");
446 expect(u, "%r", "/cgroup-root/app.slice/app-blah.slice");
447 expect(u, "%R", "/cgroup-root");
250e9fad
ZJS
448
449 /* templated with components */
450 assert_se(u = unit_new(m, sizeof(Slice)));
451 assert_se(unit_add_name(u, "blah-blah\\x2d.slice") == 0);
452
250e9fad
ZJS
453 expect(u, "%i", "");
454 expect(u, "%I", "");
455 expect(u, "%j", "blah\\x2d");
456 expect(u, "%J", "blah-");
8b4679a6
ZJS
457 expect(u, "%n", "blah-blah\\x2d.slice");
458 expect(u, "%N", "blah-blah\\x2d");
459 expect(u, "%p", "blah-blah\\x2d");
460 expect(u, "%P", "blah/blah-");
461 expect(u, "%f", "/blah/blah-");
462
463 /* deprecated */
464 expect(u, "%c", "/cgroup-root/blah-blah\\x2d.slice");
465 expect(u, "%r", "/cgroup-root");
466 expect(u, "%R", "/cgroup-root");
250e9fad 467
fee0a921 468#undef expect
b463b813 469
49e5de64 470 return 0;
1682ff60
ZJS
471}
472
26e555cb 473TEST(unit_instance_is_valid) {
068ae9fb
RC
474 assert_se(unit_instance_is_valid("fooBar"));
475 assert_se(unit_instance_is_valid("foo-bar"));
476 assert_se(unit_instance_is_valid("foo.stUff"));
477 assert_se(unit_instance_is_valid("fOo123.stuff"));
478 assert_se(unit_instance_is_valid("@f_oo123.Stuff"));
479
480 assert_se(!unit_instance_is_valid("$¢£"));
481 assert_se(!unit_instance_is_valid(""));
482 assert_se(!unit_instance_is_valid("foo bar"));
483 assert_se(!unit_instance_is_valid("foo/bar"));
484}
485
26e555cb 486TEST(unit_prefix_is_valid) {
068ae9fb
RC
487 assert_se(unit_prefix_is_valid("fooBar"));
488 assert_se(unit_prefix_is_valid("foo-bar"));
489 assert_se(unit_prefix_is_valid("foo.stUff"));
490 assert_se(unit_prefix_is_valid("fOo123.stuff"));
491 assert_se(unit_prefix_is_valid("foo123.Stuff"));
492
493 assert_se(!unit_prefix_is_valid("$¢£"));
494 assert_se(!unit_prefix_is_valid(""));
495 assert_se(!unit_prefix_is_valid("foo bar"));
496 assert_se(!unit_prefix_is_valid("foo/bar"));
497 assert_se(!unit_prefix_is_valid("@foo-bar"));
498}
499
26e555cb 500TEST(unit_name_change_suffix) {
7410616c 501 char *t;
068ae9fb 502
7410616c 503 assert_se(unit_name_change_suffix("foo.mount", ".service", &t) == 0);
c79e88b3 504 ASSERT_STREQ(t, "foo.service");
7410616c 505 free(t);
068ae9fb 506
7410616c 507 assert_se(unit_name_change_suffix("foo@stuff.service", ".socket", &t) == 0);
c79e88b3 508 ASSERT_STREQ(t, "foo@stuff.socket");
7410616c 509 free(t);
068ae9fb
RC
510}
511
26e555cb 512TEST(unit_name_build) {
7410616c 513 char *t;
068ae9fb 514
7410616c 515 assert_se(unit_name_build("foo", "bar", ".service", &t) == 0);
c79e88b3 516 ASSERT_STREQ(t, "foo@bar.service");
7410616c 517 free(t);
068ae9fb 518
7410616c 519 assert_se(unit_name_build("fo0-stUff_b", "bar", ".mount", &t) == 0);
c79e88b3 520 ASSERT_STREQ(t, "fo0-stUff_b@bar.mount");
7410616c 521 free(t);
068ae9fb 522
7410616c 523 assert_se(unit_name_build("foo", NULL, ".service", &t) == 0);
c79e88b3 524 ASSERT_STREQ(t, "foo.service");
7410616c 525 free(t);
068ae9fb
RC
526}
527
26e555cb 528TEST(slice_name_is_valid) {
0682ed5c
ZJS
529 assert_se( slice_name_is_valid(SPECIAL_ROOT_SLICE));
530 assert_se( slice_name_is_valid("foo.slice"));
531 assert_se( slice_name_is_valid("foo-bar.slice"));
532 assert_se( slice_name_is_valid("foo-bar-baz.slice"));
93c47472
LP
533 assert_se(!slice_name_is_valid("-foo-bar-baz.slice"));
534 assert_se(!slice_name_is_valid("foo-bar-baz-.slice"));
535 assert_se(!slice_name_is_valid("-foo-bar-baz-.slice"));
536 assert_se(!slice_name_is_valid("foo-bar--baz.slice"));
537 assert_se(!slice_name_is_valid("foo--bar--baz.slice"));
538 assert_se(!slice_name_is_valid(".slice"));
539 assert_se(!slice_name_is_valid(""));
540 assert_se(!slice_name_is_valid("foo.service"));
0682ed5c
ZJS
541
542 assert_se(!slice_name_is_valid("foo@.slice"));
543 assert_se(!slice_name_is_valid("foo@bar.slice"));
544 assert_se(!slice_name_is_valid("foo-bar@baz.slice"));
545 assert_se(!slice_name_is_valid("foo@bar@baz.slice"));
546 assert_se(!slice_name_is_valid("foo@bar-baz.slice"));
547 assert_se(!slice_name_is_valid("-foo-bar-baz@.slice"));
548 assert_se(!slice_name_is_valid("foo-bar-baz@-.slice"));
549 assert_se(!slice_name_is_valid("foo-bar-baz@a--b.slice"));
550 assert_se(!slice_name_is_valid("-foo-bar-baz@-.slice"));
551 assert_se(!slice_name_is_valid("foo-bar--baz@.slice"));
552 assert_se(!slice_name_is_valid("foo--bar--baz@.slice"));
553 assert_se(!slice_name_is_valid("@.slice"));
554 assert_se(!slice_name_is_valid("foo@bar.service"));
93c47472
LP
555}
556
26e555cb 557TEST(build_subslice) {
068ae9fb
RC
558 char *a;
559 char *b;
560
e5af6e0e 561 assert_se(slice_build_subslice(SPECIAL_ROOT_SLICE, "foo", &a) >= 0);
7410616c 562 assert_se(slice_build_subslice(a, "bar", &b) >= 0);
068ae9fb 563 free(a);
7410616c 564 assert_se(slice_build_subslice(b, "barfoo", &a) >= 0);
068ae9fb 565 free(b);
7410616c 566 assert_se(slice_build_subslice(a, "foobar", &b) >= 0);
068ae9fb 567 free(a);
c79e88b3 568 ASSERT_STREQ(b, "foo-bar-barfoo-foobar.slice");
068ae9fb
RC
569 free(b);
570
7410616c
LP
571 assert_se(slice_build_subslice("foo.service", "bar", &a) < 0);
572 assert_se(slice_build_subslice("foo", "bar", &a) < 0);
068ae9fb
RC
573}
574
93c47472
LP
575static void test_build_parent_slice_one(const char *name, const char *expect, int ret) {
576 _cleanup_free_ char *s = NULL;
577
578 assert_se(slice_build_parent_slice(name, &s) == ret);
c79e88b3 579 ASSERT_STREQ(s, expect);
93c47472
LP
580}
581
26e555cb 582TEST(build_parent_slice) {
e5af6e0e
ZJS
583 test_build_parent_slice_one(SPECIAL_ROOT_SLICE, NULL, 0);
584 test_build_parent_slice_one("foo.slice", SPECIAL_ROOT_SLICE, 1);
93c47472
LP
585 test_build_parent_slice_one("foo-bar.slice", "foo.slice", 1);
586 test_build_parent_slice_one("foo-bar-baz.slice", "foo-bar.slice", 1);
587 test_build_parent_slice_one("foo-bar--baz.slice", NULL, -EINVAL);
588 test_build_parent_slice_one("-foo-bar.slice", NULL, -EINVAL);
589 test_build_parent_slice_one("foo-bar-.slice", NULL, -EINVAL);
590 test_build_parent_slice_one("foo-bar.service", NULL, -EINVAL);
591 test_build_parent_slice_one(".slice", NULL, -EINVAL);
0682ed5c
ZJS
592 test_build_parent_slice_one("foo@bar.slice", NULL, -EINVAL);
593 test_build_parent_slice_one("foo-bar@baz.slice", NULL, -EINVAL);
594 test_build_parent_slice_one("foo-bar--@baz.slice", NULL, -EINVAL);
595 test_build_parent_slice_one("-foo-bar@bar.slice", NULL, -EINVAL);
596 test_build_parent_slice_one("foo-bar@-.slice", NULL, -EINVAL);
597 test_build_parent_slice_one("foo@bar.service", NULL, -EINVAL);
598 test_build_parent_slice_one("@.slice", NULL, -EINVAL);
93c47472
LP
599}
600
26e555cb 601TEST(unit_name_to_instance) {
73ce91a0 602 UnitNameFlags r;
068ae9fb 603 char *instance;
068ae9fb
RC
604
605 r = unit_name_to_instance("foo@bar.service", &instance);
b124d3f2 606 assert_se(r == UNIT_NAME_INSTANCE);
c79e88b3 607 ASSERT_STREQ(instance, "bar");
068ae9fb
RC
608 free(instance);
609
fee0a921 610 r = unit_name_to_instance("foo@.service", &instance);
b124d3f2 611 assert_se(r == UNIT_NAME_TEMPLATE);
c79e88b3 612 ASSERT_STREQ(instance, "");
fee0a921
RC
613 free(instance);
614
7410616c 615 r = unit_name_to_instance("fo0-stUff_b@b.service", &instance);
b124d3f2 616 assert_se(r == UNIT_NAME_INSTANCE);
c79e88b3 617 ASSERT_STREQ(instance, "b");
068ae9fb
RC
618 free(instance);
619
7410616c 620 r = unit_name_to_instance("foo.service", &instance);
b124d3f2 621 assert_se(r == UNIT_NAME_PLAIN);
068ae9fb
RC
622 assert_se(!instance);
623
624 r = unit_name_to_instance("fooj@unk", &instance);
625 assert_se(r < 0);
b124d3f2 626 assert_se(!instance);
fee0a921
RC
627
628 r = unit_name_to_instance("foo@", &instance);
629 assert_se(r < 0);
b124d3f2 630 assert_se(!instance);
068ae9fb
RC
631}
632
26e555cb 633TEST(unit_name_escape) {
3d41b6b8 634 _cleanup_free_ char *r = NULL;
068ae9fb
RC
635
636 r = unit_name_escape("ab+-c.a/bc@foo.service");
637 assert_se(r);
c79e88b3 638 ASSERT_STREQ(r, "ab\\x2b\\x2dc.a-bc\\x40foo.service");
068ae9fb
RC
639}
640
7410616c
LP
641static void test_u_n_t_one(const char *name, const char *expected, int ret) {
642 _cleanup_free_ char *f = NULL;
fee0a921 643
7410616c
LP
644 assert_se(unit_name_template(name, &f) == ret);
645 printf("got: %s, expected: %s\n", strna(f), strna(expected));
c79e88b3 646 ASSERT_STREQ(f, expected);
7410616c
LP
647}
648
26e555cb 649TEST(unit_name_template) {
7410616c
LP
650 test_u_n_t_one("foo@bar.service", "foo@.service", 0);
651 test_u_n_t_one("foo.mount", NULL, -EINVAL);
fee0a921
RC
652}
653
93c47472
LP
654static void test_unit_name_path_unescape_one(const char *name, const char *path, int ret) {
655 _cleanup_free_ char *p = NULL;
656
657 assert_se(unit_name_path_unescape(name, &p) == ret);
c79e88b3 658 ASSERT_STREQ(path, p);
93c47472
LP
659}
660
26e555cb 661TEST(unit_name_path_unescape) {
93c47472
LP
662 test_unit_name_path_unescape_one("foo", "/foo", 0);
663 test_unit_name_path_unescape_one("foo-bar", "/foo/bar", 0);
664 test_unit_name_path_unescape_one("foo-.bar", "/foo/.bar", 0);
665 test_unit_name_path_unescape_one("foo-bar-baz", "/foo/bar/baz", 0);
666 test_unit_name_path_unescape_one("-", "/", 0);
667 test_unit_name_path_unescape_one("--", NULL, -EINVAL);
668 test_unit_name_path_unescape_one("-foo-bar", NULL, -EINVAL);
669 test_unit_name_path_unescape_one("foo--bar", NULL, -EINVAL);
670 test_unit_name_path_unescape_one("foo-bar-", NULL, -EINVAL);
671 test_unit_name_path_unescape_one(".-bar", NULL, -EINVAL);
672 test_unit_name_path_unescape_one("foo-..", NULL, -EINVAL);
673 test_unit_name_path_unescape_one("", NULL, -EINVAL);
674}
675
72406c2f
LP
676static void test_unit_name_to_prefix_one(const char *input, int ret, const char *output) {
677 _cleanup_free_ char *k = NULL;
678
679 assert_se(unit_name_to_prefix(input, &k) == ret);
c79e88b3 680 ASSERT_STREQ(k, output);
72406c2f
LP
681}
682
26e555cb 683TEST(unit_name_to_prefix) {
72406c2f
LP
684 test_unit_name_to_prefix_one("foobar.service", 0, "foobar");
685 test_unit_name_to_prefix_one("", -EINVAL, NULL);
686 test_unit_name_to_prefix_one("foobar", -EINVAL, NULL);
687 test_unit_name_to_prefix_one(".service", -EINVAL, NULL);
688 test_unit_name_to_prefix_one("quux.quux", -EINVAL, NULL);
689 test_unit_name_to_prefix_one("quux.mount", 0, "quux");
690 test_unit_name_to_prefix_one("quux-quux.mount", 0, "quux-quux");
691 test_unit_name_to_prefix_one("quux@bar.mount", 0, "quux");
692 test_unit_name_to_prefix_one("quux-@.mount", 0, "quux-");
693 test_unit_name_to_prefix_one("@.mount", -EINVAL, NULL);
694}
695
b4152e9b
YW
696static void test_unit_name_from_dbus_path_one(const char *input, int ret, const char *output) {
697 _cleanup_free_ char *k = NULL;
698
699 assert_se(unit_name_from_dbus_path(input, &k) == ret);
c79e88b3 700 ASSERT_STREQ(k, output);
b4152e9b
YW
701}
702
26e555cb 703TEST(unit_name_from_dbus_path) {
b4152e9b
YW
704 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dbus_2esocket", 0, "dbus.socket");
705 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/_2d_2emount", 0, "-.mount");
706 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/_2d_2eslice", 0, "-.slice");
707 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/accounts_2ddaemon_2eservice", 0, "accounts-daemon.service");
708 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/auditd_2eservice", 0, "auditd.service");
709 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/basic_2etarget", 0, "basic.target");
710 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/bluetooth_2etarget", 0, "bluetooth.target");
711 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/boot_2eautomount", 0, "boot.automount");
712 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/boot_2emount", 0, "boot.mount");
713 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/btrfs_2emount", 0, "btrfs.mount");
714 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/cryptsetup_2dpre_2etarget", 0, "cryptsetup-pre.target");
715 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/cryptsetup_2etarget", 0, "cryptsetup.target");
716 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dbus_2eservice", 0, "dbus.service");
717 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dbus_2esocket", 0, "dbus.socket");
718 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dcdrom_2edevice", 0, "dev-cdrom.device");
719 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2data_5cx2dINTEL_5fSSDSA2M120G2GC_5fCVPO044405HH120QGN_2edevice", 0, "dev-disk-by\\x2did-ata\\x2dINTEL_SSDSA2M120G2GC_CVPO044405HH120QGN.device");
720 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2data_5cx2dINTEL_5fSSDSA2M120G2GC_5fCVPO044405HH120QGN_5cx2dpart1_2edevice", 0, "dev-disk-by\\x2did-ata\\x2dINTEL_SSDSA2M120G2GC_CVPO044405HH120QGN\\x2dpart1.device");
721 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2data_5cx2dINTEL_5fSSDSA2M160G2GC_5fCVPO951003RY160AGN_2edevice", 0, "dev-disk-by\\x2did-ata\\x2dINTEL_SSDSA2M160G2GC_CVPO951003RY160AGN.device");
722 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2data_5cx2dINTEL_5fSSDSA2M160G2GC_5fCVPO951003RY160AGN_5cx2dpart1_2edevice", 0, "dev-disk-by\\x2did-ata\\x2dINTEL_SSDSA2M160G2GC_CVPO951003RY160AGN\\x2dpart1.device");
723 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2data_5cx2dINTEL_5fSSDSA2M160G2GC_5fCVPO951003RY160AGN_5cx2dpart2_2edevice", 0, "dev-disk-by\\x2did-ata\\x2dINTEL_SSDSA2M160G2GC_CVPO951003RY160AGN\\x2dpart2.device");
724 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2data_5cx2dINTEL_5fSSDSA2M160G2GC_5fCVPO951003RY160AGN_5cx2dpart3_2edevice", 0, "dev-disk-by\\x2did-ata\\x2dINTEL_SSDSA2M160G2GC_CVPO951003RY160AGN\\x2dpart3.device");
725 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2data_5cx2dTSSTcorp_5fCDDVDW_5fTS_5cx2dL633C_5fR6176GLZB14646_2edevice", 0, "dev-disk-by\\x2did-ata\\x2dTSSTcorp_CDDVDW_TS\\x2dL633C_R6176GLZB14646.device");
726 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2dwwn_5cx2d0x50015179591245ae_2edevice", 0, "dev-disk-by\\x2did-wwn\\x2d0x50015179591245ae.device");
727 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2dwwn_5cx2d0x50015179591245ae_5cx2dpart1_2edevice", 0, "dev-disk-by\\x2did-wwn\\x2d0x50015179591245ae\\x2dpart1.device");
728 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2dwwn_5cx2d0x50015179591245ae_5cx2dpart2_2edevice", 0, "dev-disk-by\\x2did-wwn\\x2d0x50015179591245ae\\x2dpart2.device");
729 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2dwwn_5cx2d0x50015179591245ae_5cx2dpart3_2edevice", 0, "dev-disk-by\\x2did-wwn\\x2d0x50015179591245ae\\x2dpart3.device");
730 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2dwwn_5cx2d0x500151795946eab5_2edevice", 0, "dev-disk-by\\x2did-wwn\\x2d0x500151795946eab5.device");
731 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2did_2dwwn_5cx2d0x500151795946eab5_5cx2dpart1_2edevice", 0, "dev-disk-by\\x2did-wwn\\x2d0x500151795946eab5\\x2dpart1.device");
732 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dlabel_2d_5cxe3_5cx82_5cxb7_5cxe3_5cx82_5cxb9_5cxe3_5cx83_5cx86_5cxe3_5cx83_5cxa0_5cxe3_5cx81_5cxa7_5cxe4_5cxba_5cx88_5cxe7_5cxb4_5cx84_5cxe6_5cxb8_5cx88_5cxe3_5cx81_5cxbf_2edevice", 0, "dev-disk-by\\x2dlabel-\\xe3\\x82\\xb7\\xe3\\x82\\xb9\\xe3\\x83\\x86\\xe3\\x83\\xa0\\xe3\\x81\\xa7\\xe4\\xba\\x88\\xe7\\xb4\\x84\\xe6\\xb8\\x88\\xe3\\x81\\xbf.device");
733 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpartuuid_2d59834e50_5cx2d01_2edevice", 0, "dev-disk-by\\x2dpartuuid-59834e50\\x2d01.device");
734 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpartuuid_2d63e2a7b3_5cx2d01_2edevice", 0, "dev-disk-by\\x2dpartuuid-63e2a7b3\\x2d01.device");
735 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpartuuid_2d63e2a7b3_5cx2d02_2edevice", 0, "dev-disk-by\\x2dpartuuid-63e2a7b3\\x2d02.device");
736 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpartuuid_2d63e2a7b3_5cx2d03_2edevice", 0, "dev-disk-by\\x2dpartuuid-63e2a7b3\\x2d03.device");
737 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpath_2dpci_5cx2d0000_3a00_3a1f_2e2_5cx2data_5cx2d1_2edevice", 0, "dev-disk-by\\x2dpath-pci\\x2d0000:00:1f.2\\x2data\\x2d1.device");
738 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpath_2dpci_5cx2d0000_3a00_3a1f_2e2_5cx2data_5cx2d1_5cx2dpart1_2edevice", 0, "dev-disk-by\\x2dpath-pci\\x2d0000:00:1f.2\\x2data\\x2d1\\x2dpart1.device");
739 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpath_2dpci_5cx2d0000_3a00_3a1f_2e2_5cx2data_5cx2d1_5cx2dpart2_2edevice", 0, "dev-disk-by\\x2dpath-pci\\x2d0000:00:1f.2\\x2data\\x2d1\\x2dpart2.device");
740 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpath_2dpci_5cx2d0000_3a00_3a1f_2e2_5cx2data_5cx2d1_5cx2dpart3_2edevice", 0, "dev-disk-by\\x2dpath-pci\\x2d0000:00:1f.2\\x2data\\x2d1\\x2dpart3.device");
741 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpath_2dpci_5cx2d0000_3a00_3a1f_2e2_5cx2data_5cx2d2_2edevice", 0, "dev-disk-by\\x2dpath-pci\\x2d0000:00:1f.2\\x2data\\x2d2.device");
742 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpath_2dpci_5cx2d0000_3a00_3a1f_2e2_5cx2data_5cx2d6_2edevice", 0, "dev-disk-by\\x2dpath-pci\\x2d0000:00:1f.2\\x2data\\x2d6.device");
743 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2dpath_2dpci_5cx2d0000_3a00_3a1f_2e2_5cx2data_5cx2d6_5cx2dpart1_2edevice", 0, "dev-disk-by\\x2dpath-pci\\x2d0000:00:1f.2\\x2data\\x2d6\\x2dpart1.device");
744 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2duuid_2d1A34E3F034E3CD37_2edevice", 0, "dev-disk-by\\x2duuid-1A34E3F034E3CD37.device");
745 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2duuid_2dB670EBFE70EBC2EB_2edevice", 0, "dev-disk-by\\x2duuid-B670EBFE70EBC2EB.device");
746 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2duuid_2dFCD4F509D4F4C6C4_2edevice", 0, "dev-disk-by\\x2duuid-FCD4F509D4F4C6C4.device");
747 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2ddisk_2dby_5cx2duuid_2db49ead57_5cx2d907c_5cx2d446c_5cx2db405_5cx2d5ca6cd865f5e_2edevice", 0, "dev-disk-by\\x2duuid-b49ead57\\x2d907c\\x2d446c\\x2db405\\x2d5ca6cd865f5e.device");
748 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dhugepages_2emount", 0, "dev-hugepages.mount");
749 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dmqueue_2emount", 0, "dev-mqueue.mount");
750 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2drfkill_2edevice", 0, "dev-rfkill.device");
751 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dsda1_2edevice", 0, "dev-sda1.device");
752 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dsda2_2edevice", 0, "dev-sda2.device");
753 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dsda3_2edevice", 0, "dev-sda3.device");
754 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dsda_2edevice", 0, "dev-sda.device");
755 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dsdb1_2edevice", 0, "dev-sdb1.device");
756 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dsdb_2edevice", 0, "dev-sdb.device");
757 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dsr0_2edevice", 0, "dev-sr0.device");
758 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS0_2edevice", 0, "dev-ttyS0.device");
759 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS10_2edevice", 0, "dev-ttyS10.device");
760 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS11_2edevice", 0, "dev-ttyS11.device");
761 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS12_2edevice", 0, "dev-ttyS12.device");
762 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS13_2edevice", 0, "dev-ttyS13.device");
763 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS14_2edevice", 0, "dev-ttyS14.device");
764 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS15_2edevice", 0, "dev-ttyS15.device");
765 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS16_2edevice", 0, "dev-ttyS16.device");
766 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS17_2edevice", 0, "dev-ttyS17.device");
767 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS18_2edevice", 0, "dev-ttyS18.device");
768 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS19_2edevice", 0, "dev-ttyS19.device");
769 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS1_2edevice", 0, "dev-ttyS1.device");
770 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS20_2edevice", 0, "dev-ttyS20.device");
771 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS21_2edevice", 0, "dev-ttyS21.device");
772 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS22_2edevice", 0, "dev-ttyS22.device");
773 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS23_2edevice", 0, "dev-ttyS23.device");
774 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS24_2edevice", 0, "dev-ttyS24.device");
775 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS25_2edevice", 0, "dev-ttyS25.device");
776 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS26_2edevice", 0, "dev-ttyS26.device");
777 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS27_2edevice", 0, "dev-ttyS27.device");
778 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS28_2edevice", 0, "dev-ttyS28.device");
779 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS29_2edevice", 0, "dev-ttyS29.device");
780 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS2_2edevice", 0, "dev-ttyS2.device");
781 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS30_2edevice", 0, "dev-ttyS30.device");
782 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS31_2edevice", 0, "dev-ttyS31.device");
783 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS3_2edevice", 0, "dev-ttyS3.device");
784 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS4_2edevice", 0, "dev-ttyS4.device");
785 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS5_2edevice", 0, "dev-ttyS5.device");
786 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS6_2edevice", 0, "dev-ttyS6.device");
787 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS7_2edevice", 0, "dev-ttyS7.device");
788 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS8_2edevice", 0, "dev-ttyS8.device");
789 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dev_2dttyS9_2edevice", 0, "dev-ttyS9.device");
790 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dracut_2dcmdline_2eservice", 0, "dracut-cmdline.service");
791 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dracut_2dinitqueue_2eservice", 0, "dracut-initqueue.service");
792 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dracut_2dmount_2eservice", 0, "dracut-mount.service");
793 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dracut_2dpre_2dmount_2eservice", 0, "dracut-pre-mount.service");
794 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dracut_2dpre_2dpivot_2eservice", 0, "dracut-pre-pivot.service");
795 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dracut_2dpre_2dtrigger_2eservice", 0, "dracut-pre-trigger.service");
796 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dracut_2dpre_2dudev_2eservice", 0, "dracut-pre-udev.service");
797 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/dracut_2dshutdown_2eservice", 0, "dracut-shutdown.service");
798 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/ebtables_2eservice", 0, "ebtables.service");
799 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/emergency_2eservice", 0, "emergency.service");
800 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/emergency_2etarget", 0, "emergency.target");
801 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/fedora_2dimport_2dstate_2eservice", 0, "fedora-import-state.service");
802 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/fedora_2dreadonly_2eservice", 0, "fedora-readonly.service");
803 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/firewalld_2eservice", 0, "firewalld.service");
804 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/getty_2dpre_2etarget", 0, "getty-pre.target");
805 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/getty_2etarget", 0, "getty.target");
806 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/getty_40tty1_2eservice", 0, "getty@tty1.service");
807 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/graphical_2etarget", 0, "graphical.target");
808 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/home_2emount", 0, "home.mount");
809 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/init_2escope", 0, "init.scope");
810 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/initrd_2dcleanup_2eservice", 0, "initrd-cleanup.service");
811 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/initrd_2dfs_2etarget", 0, "initrd-fs.target");
812 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/initrd_2dparse_2detc_2eservice", 0, "initrd-parse-etc.service");
813 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/initrd_2droot_2ddevice_2etarget", 0, "initrd-root-device.target");
814 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/initrd_2droot_2dfs_2etarget", 0, "initrd-root-fs.target");
815 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/initrd_2dswitch_2droot_2eservice", 0, "initrd-switch-root.service");
816 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/initrd_2dswitch_2droot_2etarget", 0, "initrd-switch-root.target");
817 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/initrd_2dudevadm_2dcleanup_2ddb_2eservice", 0, "initrd-udevadm-cleanup-db.service");
818 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/initrd_2etarget", 0, "initrd.target");
819 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/ip6tables_2eservice", 0, "ip6tables.service");
820 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/ipset_2eservice", 0, "ipset.service");
821 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/iptables_2eservice", 0, "iptables.service");
822 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/irqbalance_2eservice", 0, "irqbalance.service");
823 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/kmod_2dstatic_2dnodes_2eservice", 0, "kmod-static-nodes.service");
824 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/ldconfig_2eservice", 0, "ldconfig.service");
825 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/lightdm_2eservice", 0, "lightdm.service");
826 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/livesys_2dlate_2eservice", 0, "livesys-late.service");
827 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/lm_5fsensors_2eservice", 0, "lm_sensors.service");
828 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/local_2dfs_2dpre_2etarget", 0, "local-fs-pre.target");
829 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/local_2dfs_2etarget", 0, "local-fs.target");
830 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/machines_2etarget", 0, "machines.target");
831 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/mcelog_2eservice", 0, "mcelog.service");
832 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/multi_2duser_2etarget", 0, "multi-user.target");
833 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/network_2dpre_2etarget", 0, "network-pre.target");
834 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/network_2etarget", 0, "network.target");
835 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/nss_2dlookup_2etarget", 0, "nss-lookup.target");
836 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/nss_2duser_2dlookup_2etarget", 0, "nss-user-lookup.target");
837 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/paths_2etarget", 0, "paths.target");
838 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/plymouth_2dquit_2dwait_2eservice", 0, "plymouth-quit-wait.service");
839 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/plymouth_2dquit_2eservice", 0, "plymouth-quit.service");
840 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/plymouth_2dstart_2eservice", 0, "plymouth-start.service");
841 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/polkit_2eservice", 0, "polkit.service");
842 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/proc_2dsys_2dfs_2dbinfmt_5fmisc_2eautomount", 0, "proc-sys-fs-binfmt_misc.automount");
843 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/proc_2dsys_2dfs_2dbinfmt_5fmisc_2emount", 0, "proc-sys-fs-binfmt_misc.mount");
b4152e9b
YW
844 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/remote_2dcryptsetup_2etarget", 0, "remote-cryptsetup.target");
845 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/remote_2dfs_2dpre_2etarget", 0, "remote-fs-pre.target");
846 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/remote_2dfs_2etarget", 0, "remote-fs.target");
847 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/rescue_2eservice", 0, "rescue.service");
848 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/rescue_2etarget", 0, "rescue.target");
849 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/run_2duser_2d1000_2emount", 0, "run-user-1000.mount");
850 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/session_2d2_2escope", 0, "session-2.scope");
851 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/shutdown_2etarget", 0, "shutdown.target");
852 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/slices_2etarget", 0, "slices.target");
853 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/smartd_2eservice", 0, "smartd.service");
854 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sockets_2etarget", 0, "sockets.target");
855 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sound_2etarget", 0, "sound.target");
856 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sshd_2dkeygen_2etarget", 0, "sshd-keygen.target");
857 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sshd_2dkeygen_40ecdsa_2eservice", 0, "sshd-keygen@ecdsa.service");
858 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sshd_2dkeygen_40ed25519_2eservice", 0, "sshd-keygen@ed25519.service");
859 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sshd_2dkeygen_40rsa_2eservice", 0, "sshd-keygen@rsa.service");
860 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sshd_2eservice", 0, "sshd.service");
861 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/swap_2etarget", 0, "swap.target");
862 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a02_2e0_2dbacklight_2dacpi_5fvideo0_2edevice", 0, "sys-devices-pci0000:00-0000:00:02.0-backlight-acpi_video0.device");
863 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a02_2e0_2ddrm_2dcard0_2dcard0_5cx2dLVDS_5cx2d1_2dintel_5fbacklight_2edevice", 0, "sys-devices-pci0000:00-0000:00:02.0-drm-card0-card0\\x2dLVDS\\x2d1-intel_backlight.device");
864 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1a_2e0_2dusb1_2d1_5cx2d1_2d1_5cx2d1_2e6_2d1_5cx2d1_2e6_3a1_2e0_2dbluetooth_2dhci0_2edevice", 0, "sys-devices-pci0000:00-0000:00:1a.0-usb1-1\\x2d1-1\\x2d1.6-1\\x2d1.6:1.0-bluetooth-hci0.device");
865 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1b_2e0_2dsound_2dcard0_2edevice", 0, "sys-devices-pci0000:00-0000:00:1b.0-sound-card0.device");
866 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1c_2e0_2d0000_3a02_3a00_2e0_2dnet_2dwlp2s0_2edevice", 0, "sys-devices-pci0000:00-0000:00:1c.0-0000:02:00.0-net-wlp2s0.device");
867 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1c_2e2_2d0000_3a04_3a00_2e0_2dnet_2denp4s0_2edevice", 0, "sys-devices-pci0000:00-0000:00:1c.2-0000:04:00.0-net-enp4s0.device");
868 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1f_2e2_2data1_2dhost0_2dtarget0_3a0_3a0_2d0_3a0_3a0_3a0_2dblock_2dsda_2dsda1_2edevice", 0, "sys-devices-pci0000:00-0000:00:1f.2-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda1.device");
869 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1f_2e2_2data1_2dhost0_2dtarget0_3a0_3a0_2d0_3a0_3a0_3a0_2dblock_2dsda_2dsda2_2edevice", 0, "sys-devices-pci0000:00-0000:00:1f.2-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda2.device");
870 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1f_2e2_2data1_2dhost0_2dtarget0_3a0_3a0_2d0_3a0_3a0_3a0_2dblock_2dsda_2dsda3_2edevice", 0, "sys-devices-pci0000:00-0000:00:1f.2-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda3.device");
871 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1f_2e2_2data1_2dhost0_2dtarget0_3a0_3a0_2d0_3a0_3a0_3a0_2dblock_2dsda_2edevice", 0, "sys-devices-pci0000:00-0000:00:1f.2-ata1-host0-target0:0:0-0:0:0:0-block-sda.device");
872 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1f_2e2_2data2_2dhost1_2dtarget1_3a0_3a0_2d1_3a0_3a0_3a0_2dblock_2dsr0_2edevice", 0, "sys-devices-pci0000:00-0000:00:1f.2-ata2-host1-target1:0:0-1:0:0:0-block-sr0.device");
873 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1f_2e2_2data6_2dhost5_2dtarget5_3a0_3a0_2d5_3a0_3a0_3a0_2dblock_2dsdb_2dsdb1_2edevice", 0, "sys-devices-pci0000:00-0000:00:1f.2-ata6-host5-target5:0:0-5:0:0:0-block-sdb-sdb1.device");
874 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dpci0000_3a00_2d0000_3a00_3a1f_2e2_2data6_2dhost5_2dtarget5_3a0_3a0_2d5_3a0_3a0_3a0_2dblock_2dsdb_2edevice", 0, "sys-devices-pci0000:00-0000:00:1f.2-ata6-host5-target5:0:0-5:0:0:0-block-sdb.device");
875 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS0_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS0.device");
876 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS10_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS10.device");
877 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS11_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS11.device");
878 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS12_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS12.device");
879 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS13_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS13.device");
880 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS14_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS14.device");
881 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS15_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS15.device");
882 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS16_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS16.device");
883 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS17_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS17.device");
884 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS18_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS18.device");
885 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS19_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS19.device");
886 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS1_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS1.device");
887 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS20_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS20.device");
888 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS21_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS21.device");
889 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS22_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS22.device");
890 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS23_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS23.device");
891 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS24_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS24.device");
892 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS25_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS25.device");
893 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS26_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS26.device");
894 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS27_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS27.device");
895 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS28_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS28.device");
896 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS29_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS29.device");
897 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS2_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS2.device");
898 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS30_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS30.device");
899 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS31_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS31.device");
900 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS3_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS3.device");
901 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS4_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS4.device");
902 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS5_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS5.device");
903 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS6_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS6.device");
904 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS7_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS7.device");
905 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS8_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS8.device");
906 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dplatform_2dserial8250_2dtty_2dttyS9_2edevice", 0, "sys-devices-platform-serial8250-tty-ttyS9.device");
907 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2ddevices_2dvirtual_2dmisc_2drfkill_2edevice", 0, "sys-devices-virtual-misc-rfkill.device");
908 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2dfs_2dfuse_2dconnections_2emount", 0, "sys-fs-fuse-connections.mount");
909 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2dkernel_2dconfig_2emount", 0, "sys-kernel-config.mount");
910 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2dkernel_2ddebug_2emount", 0, "sys-kernel-debug.mount");
911 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2dmodule_2dconfigfs_2edevice", 0, "sys-module-configfs.device");
912 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2dsubsystem_2dbluetooth_2ddevices_2dhci0_2edevice", 0, "sys-subsystem-bluetooth-devices-hci0.device");
913 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2dsubsystem_2dnet_2ddevices_2denp4s0_2edevice", 0, "sys-subsystem-net-devices-enp4s0.device");
914 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sys_2dsubsystem_2dnet_2ddevices_2dwlp2s0_2edevice", 0, "sys-subsystem-net-devices-wlp2s0.device");
915 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sysinit_2etarget", 0, "sysinit.target");
916 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/syslog_2eservice", 0, "syslog.service");
917 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/syslog_2esocket", 0, "syslog.socket");
918 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/syslog_2etarget", 0, "syslog.target");
919 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/sysroot_2emount", 0, "sysroot.mount");
920 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/system_2dgetty_2eslice", 0, "system-getty.slice");
921 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/system_2dsshd_5cx2dkeygen_2eslice", 0, "system-sshd\\x2dkeygen.slice");
922 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/system_2dsystemd_5cx2dbacklight_2eslice", 0, "system-systemd\\x2dbacklight.slice");
923 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/system_2dsystemd_5cx2dcoredump_2eslice", 0, "system-systemd\\x2dcoredump.slice");
924 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/system_2duser_5cx2druntime_5cx2ddir_2eslice", 0, "system-user\\x2druntime\\x2ddir.slice");
925 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/system_2eslice", 0, "system.slice");
926 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dask_2dpassword_2dconsole_2epath", 0, "systemd-ask-password-console.path");
927 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dask_2dpassword_2dconsole_2eservice", 0, "systemd-ask-password-console.service");
928 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dask_2dpassword_2dwall_2epath", 0, "systemd-ask-password-wall.path");
929 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dask_2dpassword_2dwall_2eservice", 0, "systemd-ask-password-wall.service");
930 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dbacklight_40backlight_3aacpi_5fvideo0_2eservice", 0, "systemd-backlight@backlight:acpi_video0.service");
931 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dbacklight_40backlight_3aintel_5fbacklight_2eservice", 0, "systemd-backlight@backlight:intel_backlight.service");
932 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dbinfmt_2eservice", 0, "systemd-binfmt.service");
933 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dcoredump_2esocket", 0, "systemd-coredump.socket");
934 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dcoredump_400_2eservice", 0, "systemd-coredump@0.service");
935 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dfirstboot_2eservice", 0, "systemd-firstboot.service");
5ff8da10 936 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dfsck_2droot_2eservice", 0, SPECIAL_FSCK_ROOT_SERVICE);
b4152e9b 937 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dhwdb_2dupdate_2eservice", 0, "systemd-hwdb-update.service");
b4152e9b
YW
938 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2djournal_2dcatalog_2dupdate_2eservice", 0, "systemd-journal-catalog-update.service");
939 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2djournal_2dflush_2eservice", 0, "systemd-journal-flush.service");
940 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2djournald_2daudit_2esocket", 0, "systemd-journald-audit.socket");
941 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2djournald_2ddev_2dlog_2esocket", 0, "systemd-journald-dev-log.socket");
942 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2djournald_2eservice", 0, "systemd-journald.service");
943 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2djournald_2esocket", 0, "systemd-journald.socket");
944 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dlogind_2eservice", 0, "systemd-logind.service");
945 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dmachine_2did_2dcommit_2eservice", 0, "systemd-machine-id-commit.service");
946 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dmodules_2dload_2eservice", 0, "systemd-modules-load.service");
947 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dnetworkd_2eservice", 0, "systemd-networkd.service");
948 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dnetworkd_2esocket", 0, "systemd-networkd.socket");
949 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2drandom_2dseed_2eservice", 0, "systemd-random-seed.service");
950 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dremount_2dfs_2eservice", 0, "systemd-remount-fs.service");
951 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dresolved_2eservice", 0, "systemd-resolved.service");
952 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2drfkill_2eservice", 0, "systemd-rfkill.service");
953 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2drfkill_2esocket", 0, "systemd-rfkill.socket");
954 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dsysctl_2eservice", 0, "systemd-sysctl.service");
955 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dsysusers_2eservice", 0, "systemd-sysusers.service");
956 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dtimesyncd_2eservice", 0, "systemd-timesyncd.service");
957 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dtmpfiles_2dclean_2eservice", 0, "systemd-tmpfiles-clean.service");
958 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dtmpfiles_2dclean_2etimer", 0, "systemd-tmpfiles-clean.timer");
959 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dtmpfiles_2dsetup_2ddev_2eservice", 0, "systemd-tmpfiles-setup-dev.service");
960 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dtmpfiles_2dsetup_2eservice", 0, "systemd-tmpfiles-setup.service");
961 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dudev_2dtrigger_2eservice", 0, "systemd-udev-trigger.service");
962 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dudevd_2dcontrol_2esocket", 0, "systemd-udevd-control.socket");
963 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dudevd_2dkernel_2esocket", 0, "systemd-udevd-kernel.socket");
964 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dudevd_2eservice", 0, "systemd-udevd.service");
965 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dupdate_2ddone_2eservice", 0, "systemd-update-done.service");
b4152e9b
YW
966 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dupdate_2dutmp_2eservice", 0, "systemd-update-utmp.service");
967 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2duser_2dsessions_2eservice", 0, "systemd-user-sessions.service");
968 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/systemd_2dvconsole_2dsetup_2eservice", 0, "systemd-vconsole-setup.service");
969 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/time_2dsync_2etarget", 0, "time-sync.target");
970 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/timers_2etarget", 0, "timers.target");
971 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/tmp_2emount", 0, "tmp.mount");
972 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/umount_2etarget", 0, "umount.target");
973 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/unbound_2danchor_2eservice", 0, "unbound-anchor.service");
974 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/unbound_2danchor_2etimer", 0, "unbound-anchor.timer");
975 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/upower_2eservice", 0, "upower.service");
976 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/user_2d1000_2eslice", 0, "user-1000.slice");
977 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/user_2druntime_2ddir_401000_2eservice", 0, "user-runtime-dir@1000.service");
978 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/user_2eslice", 0, "user.slice");
979 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/user_401000_2eservice", 0, "user@1000.service");
980 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/usr_2dlocal_2dtexlive_2emount", 0, "usr-local-texlive.mount");
981 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/var_2dlib_2dmachines_2emount", 0, "var-lib-machines.mount");
982 test_unit_name_from_dbus_path_one("/org/freedesktop/systemd1/unit/wpa_5fsupplicant_2eservice", 0, "wpa_supplicant.service");
983}
984
26e555cb 985TEST(unit_name_prefix_equal) {
88022148
DDM
986 assert_se(unit_name_prefix_equal("a.service", "a.service"));
987 assert_se(unit_name_prefix_equal("a.service", "a.mount"));
988 assert_se(unit_name_prefix_equal("a@b.service", "a.service"));
989 assert_se(unit_name_prefix_equal("a@b.service", "a@c.service"));
990
991 assert_se(!unit_name_prefix_equal("a.service", "b.service"));
992 assert_se(!unit_name_prefix_equal("a.service", "b.mount"));
993 assert_se(!unit_name_prefix_equal("a@a.service", "b.service"));
994 assert_se(!unit_name_prefix_equal("a@a.service", "b@a.service"));
995 assert_se(!unit_name_prefix_equal("a", "b"));
996 assert_se(!unit_name_prefix_equal("a", "a"));
997}
998
99839c7e
LP
999static int intro(void) {
1000 if (enter_cgroup_subroot(NULL) == -ENOMEDIUM)
1001 return log_tests_skipped("cgroupfs not available");
26e555cb 1002
99839c7e
LP
1003 assert_se(runtime_dir = setup_fake_runtime_dir());
1004 return EXIT_SUCCESS;
1005}
26e555cb 1006
e85fdacc 1007DEFINE_TEST_MAIN_WITH_INTRO(LOG_INFO, intro);