X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftest%2Ftest-unit-name.c;h=c17692b845e5af80f469954acaf0baaec39b4ed5;hp=93bf28aacee98acc9fae250e0e7a25ce63dfa13d;hb=442e00839e4fc3c11506f5c8a9477b465865aecc;hpb=6fa4853328e3d78d092172fa54effb7e785d0a85 diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c index 93bf28aac..c17692b84 100644 --- a/src/test/test-unit-name.c +++ b/src/test/test-unit-name.c @@ -34,6 +34,7 @@ #include "specifier.h" #include "util.h" #include "macro.h" +#include "test-helper.h" static void test_replacements(void) { #define expect(pattern, repl, expected) \ @@ -124,7 +125,7 @@ static int test_unit_printf(void) { assert_se(asprintf(&root_uid, "%d", (int) root->pw_uid) > 0); r = manager_new(SYSTEMD_USER, false, &m); - if (r == -EPERM) { + if (r == -EPERM || r == -EACCES) { puts("manager_new: Permission denied. Skipping test."); return EXIT_TEST_SKIP; } @@ -190,10 +191,14 @@ static int test_unit_printf(void) { expect(u2, "%H", host); expect(u2, "%t", "/run/user/*"); + manager_free(m); + return 0; } int main(int argc, char* argv[]) { + int rc = 0; test_replacements(); - return test_unit_printf(); + TEST_REQ_RUNNING_SYSTEMD(rc = test_unit_printf()); + return rc; }