diff options
Diffstat (limited to 'src/test/test-unit-name.c')
-rw-r--r-- | src/test/test-unit-name.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c index 2b00ef8cb7..0d3674cff8 100644 --- a/src/test/test-unit-name.c +++ b/src/test/test-unit-name.c @@ -191,7 +191,7 @@ static void test_unit_name_mangle(void) { } static int test_unit_printf(void) { - _cleanup_free_ char *mid = NULL, *bid = NULL, *host = NULL, *uid = NULL, *user = NULL, *shell = NULL, *home = NULL; + _cleanup_free_ char *mid = NULL, *bid = NULL, *host = NULL, *gid = NULL, *group = NULL, *uid = NULL, *user = NULL, *shell = NULL, *home = NULL; _cleanup_(manager_freep) Manager *m = NULL; Unit *u; int r; @@ -200,15 +200,15 @@ static int test_unit_printf(void) { assert_se(specifier_boot_id('b', NULL, NULL, &bid) >= 0 && bid); assert_se(host = gethostname_malloc()); assert_se(user = uid_to_name(getuid())); + assert_se(group = gid_to_name(getgid())); assert_se(asprintf(&uid, UID_FMT, getuid())); + assert_se(asprintf(&gid, UID_FMT, getgid())); assert_se(get_home_dir(&home) >= 0); assert_se(get_shell(&shell) >= 0); r = manager_new(UNIT_FILE_USER, MANAGER_TEST_RUN_MINIMAL, &m); - if (MANAGER_SKIP_TEST(r)) { - log_notice_errno(r, "Skipping test: manager_new: %m"); - return EXIT_TEST_SKIP; - } + if (MANAGER_SKIP_TEST(r)) + return log_tests_skipped_errno(r, "manager_new"); assert_se(r == 0); #define expect(unit, pattern, expected) \ @@ -243,6 +243,8 @@ static int test_unit_printf(void) { expect(u, "%I", ""); expect(u, "%j", "blah"); expect(u, "%J", "blah"); + expect(u, "%g", group); + expect(u, "%G", gid); expect(u, "%u", user); expect(u, "%U", uid); expect(u, "%h", home); @@ -265,6 +267,8 @@ static int test_unit_printf(void) { expect(u, "%I", "foo/foo"); expect(u, "%j", "blah"); expect(u, "%J", "blah"); + expect(u, "%g", group); + expect(u, "%G", gid); expect(u, "%u", user); expect(u, "%U", uid); expect(u, "%h", home); @@ -811,14 +815,11 @@ int main(int argc, char* argv[]) { _cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL; int r, rc = 0; - log_parse_environment(); - log_open(); + test_setup_logging(LOG_INFO); r = enter_cgroup_subroot(); - if (r == -ENOMEDIUM) { - log_notice_errno(r, "Skipping test: cgroupfs not available"); - return EXIT_TEST_SKIP; - } + if (r == -ENOMEDIUM) + return log_tests_skipped("cgroupfs not available"); assert_se(runtime_dir = setup_fake_runtime_dir()); |