diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-04-12 15:51:39 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-04-16 16:08:52 +0200 |
commit | ba412430a97ffbc02b3911c1b34db63e1524f7f9 (patch) | |
tree | 3138435150b872c7a045be6d65001c4d4cee3787 /src/test/test-engine.c | |
parent | 4109ede7788c90e961b08c0da7d4da2d402931d7 (diff) | |
download | systemd-ba412430a97ffbc02b3911c1b34db63e1524f7f9.tar.gz |
tests: use manager_load_startable_unit_or_warn() to load units
Doing manager_load_unit() followed by UNIT_VTABLE(unit)->start(unit) would
result in an assertion failure in ->start() if the unit failed to load
properly. Something like this is okey-ish is tests, since the test units are
not expected to fail to load, but the reason for failure is clearer if we
fail immediately.
Diffstat (limited to 'src/test/test-engine.c')
-rw-r--r-- | src/test/test-engine.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test/test-engine.c b/src/test/test-engine.c index 5d7cd8cfd5..e5ec3972b4 100644 --- a/src/test/test-engine.c +++ b/src/test/test-engine.c @@ -56,9 +56,9 @@ int main(int argc, char *argv[]) { assert_se(manager_startup(m, serial, fdset) >= 0); printf("Load1:\n"); - assert_se(manager_load_unit(m, "a.service", NULL, NULL, &a) >= 0); - assert_se(manager_load_unit(m, "b.service", NULL, NULL, &b) >= 0); - assert_se(manager_load_unit(m, "c.service", NULL, NULL, &c) >= 0); + assert_se(manager_load_startable_unit_or_warn(m, "a.service", NULL, &a) >= 0); + assert_se(manager_load_startable_unit_or_warn(m, "b.service", NULL, &b) >= 0); + assert_se(manager_load_startable_unit_or_warn(m, "c.service", NULL, &c) >= 0); manager_dump_units(m, stdout, "\t"); printf("Test1: (Trivial)\n"); @@ -70,8 +70,8 @@ int main(int argc, char *argv[]) { printf("Load2:\n"); manager_clear_jobs(m); - assert_se(manager_load_unit(m, "d.service", NULL, NULL, &d) >= 0); - assert_se(manager_load_unit(m, "e.service", NULL, NULL, &e) >= 0); + assert_se(manager_load_startable_unit_or_warn(m, "d.service", NULL, &d) >= 0); + assert_se(manager_load_startable_unit_or_warn(m, "e.service", NULL, &e) >= 0); manager_dump_units(m, stdout, "\t"); printf("Test2: (Cyclic Order, Unfixable)\n"); @@ -87,7 +87,7 @@ int main(int argc, char *argv[]) { manager_dump_jobs(m, stdout, "\t"); printf("Load3:\n"); - assert_se(manager_load_unit(m, "g.service", NULL, NULL, &g) >= 0); + assert_se(manager_load_startable_unit_or_warn(m, "g.service", NULL, &g) >= 0); manager_dump_units(m, stdout, "\t"); printf("Test5: (Colliding transaction, fail)\n"); @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) { manager_dump_jobs(m, stdout, "\t"); printf("Load4:\n"); - assert_se(manager_load_unit(m, "h.service", NULL, NULL, &h) >= 0); + assert_se(manager_load_startable_unit_or_warn(m, "h.service", NULL, &h) >= 0); manager_dump_units(m, stdout, "\t"); printf("Test10: (Unmergeable job type of auxiliary job, fail)\n"); |