mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
test: add test for prefix unit loading
This commit is contained in:
parent
5396624506
commit
7ce49e656b
@ -19,12 +19,16 @@ int main(int argc, char *argv[]) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL;
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error err = SD_BUS_ERROR_NULL;
|
||||
_cleanup_(manager_freep) Manager *m = NULL;
|
||||
Unit *a = NULL, *b = NULL, *c = NULL, *d = NULL, *e = NULL, *g = NULL, *h = NULL;
|
||||
Unit *a = NULL, *b = NULL, *c = NULL, *d = NULL, *e = NULL, *g = NULL, *h = NULL, *unit_with_multiple_dashes = NULL;
|
||||
FILE *serial = NULL;
|
||||
FDSet *fdset = NULL;
|
||||
Job *j;
|
||||
int r;
|
||||
|
||||
log_set_max_level(LOG_DEBUG);
|
||||
log_parse_environment();
|
||||
log_open();
|
||||
|
||||
r = enter_cgroup_subroot();
|
||||
if (r == -ENOMEDIUM) {
|
||||
log_notice_errno(r, "Skipping test: cgroupfs not available");
|
||||
@ -130,5 +134,10 @@ int main(int argc, char *argv[]) {
|
||||
assert_se(!hashmap_get(a->dependencies[UNIT_PROPAGATES_RELOAD_TO], c));
|
||||
assert_se(!hashmap_get(c->dependencies[UNIT_RELOAD_PROPAGATED_FROM], a));
|
||||
|
||||
assert_se(manager_load_unit(m, "unit-with-multiple-dashes.service", NULL, NULL, &unit_with_multiple_dashes) >= 0);
|
||||
|
||||
assert_se(strv_equal(unit_with_multiple_dashes->documentation, STRV_MAKE("man:test", "man:override2", "man:override3")));
|
||||
assert_se(streq_ptr(unit_with_multiple_dashes->description, "override4"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -158,13 +158,18 @@ test_data_files = '''
|
||||
test-path/path-unit.path
|
||||
test-path/paths.target
|
||||
test-path/sysinit.target
|
||||
testsuite.target
|
||||
timers.target
|
||||
unstoppable.service
|
||||
test-umount/empty.mountinfo
|
||||
test-umount/example.swaps
|
||||
test-umount/garbled.mountinfo
|
||||
test-umount/rhbug-1554943.mountinfo
|
||||
test-umount/example.swaps
|
||||
testsuite.target
|
||||
timers.target
|
||||
unit-with-.service.d/20-override.conf
|
||||
unit-with-multiple-.service.d/20-override.conf
|
||||
unit-with-multiple-.service.d/30-override.conf
|
||||
unit-with-multiple-dashes.service
|
||||
unit-with-multiple-dashes.service.d/10-override.conf
|
||||
unstoppable.service
|
||||
'''.split()
|
||||
|
||||
if conf.get('ENABLE_RESOLVE') == 1
|
||||
|
2
test/unit-.service.d/10-override.conf
Normal file
2
test/unit-.service.d/10-override.conf
Normal file
@ -0,0 +1,2 @@
|
||||
[Unit]
|
||||
Description=override0
|
2
test/unit-with-.service.d/20-override.conf
Normal file
2
test/unit-with-.service.d/20-override.conf
Normal file
@ -0,0 +1,2 @@
|
||||
[Unit]
|
||||
Documentation=man:override1
|
2
test/unit-with-multiple-.service.d/20-override.conf
Normal file
2
test/unit-with-multiple-.service.d/20-override.conf
Normal file
@ -0,0 +1,2 @@
|
||||
[Unit]
|
||||
Documentation=man:override2
|
2
test/unit-with-multiple-.service.d/30-override.conf
Normal file
2
test/unit-with-multiple-.service.d/30-override.conf
Normal file
@ -0,0 +1,2 @@
|
||||
[Unit]
|
||||
Documentation=man:override3
|
6
test/unit-with-multiple-dashes.service
Normal file
6
test/unit-with-multiple-dashes.service
Normal file
@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=A unit with multiple dashes
|
||||
Documentation=man:test
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/true
|
@ -0,0 +1,2 @@
|
||||
[Unit]
|
||||
Description=override4
|
Loading…
Reference in New Issue
Block a user