summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-16 22:57:38 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-18 21:30:51 -0400
commit59108fbecb831664cb968ad04acb77c55a756eb1 (patch)
treea35c7776b682473e4807c6e2a79b418961341671 /src/test
parenta6612e658c19717a51366fa2e4925e557d95a427 (diff)
shared/install: report invalid unit files slightly better
When a unit file is invalid, we'd return an error without any details: $ systemctl --root=/ enable testing@instance.service Failed to enable: Invalid argument. Fix things to at least print the offending file name: $ systemctl enable testing@instance.service Failed to enable unit: File testing@instance.service: Invalid argument $ systemctl --root=/ enable testing@instance.service Failed to enable unit, file testing@instance.service: Invalid argument. A real fix would be to pass back a proper error message from conf-parser. But this would require major surgery, since conf-parser functions now simply print log errors, but we would need to return them over the bus. So let's just print the file name, to indicate where the error is. (Incomplete) fix for #4210.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-install-root.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/test-install-root.c b/src/test/test-install-root.c
index db1c928660..1686054d2a 100644
--- a/src/test/test-install-root.c
+++ b/src/test/test-install-root.c
@@ -326,7 +326,9 @@ static void test_default(const char *root) {
assert_se(unit_file_get_default(UNIT_FILE_SYSTEM, root, &def) == -ENOENT);
assert_se(unit_file_set_default(UNIT_FILE_SYSTEM, root, "idontexist.target", false, &changes, &n_changes) == -ENOENT);
- assert_se(n_changes == 0);
+ assert_se(n_changes == 1);
+ assert_se(changes[0].type == -ENOENT);
+ assert_se(streq_ptr(changes[0].path, "idontexist.target"));
unit_file_changes_free(changes, n_changes);
changes = NULL; n_changes = 0;