summaryrefslogtreecommitdiff
path: root/src/test/test-unit-name.c
diff options
context:
space:
mode:
authorDavide Cavalca <davide125@tiscali.it>2018-10-13 01:26:48 -0700
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-10-13 17:26:48 +0900
commitb75f0c69b3c80ab1d80f907de96f1c1a444c171a (patch)
treec2320b5e58c405c571b9ddd565d52d134501cc6c /src/test/test-unit-name.c
parentb4b3649a94fbb8833f946a3dae5c6ee1137cb1a9 (diff)
downloadsystemd-b75f0c69b3c80ab1d80f907de96f1c1a444c171a.tar.gz
shared: add %g, %G specifiers for group / gid (#10368)
Diffstat (limited to 'src/test/test-unit-name.c')
-rw-r--r--src/test/test-unit-name.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
index 157c900276..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,7 +200,9 @@ 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);
@@ -241,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);
@@ -263,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);