]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: test DynamicUser= with a fixed user
authorDjalal Harouni <tixxdz@opendz.org>
Wed, 2 Nov 2016 21:59:41 +0000 (22:59 +0100)
committerDjalal Harouni <tixxdz@opendz.org>
Thu, 3 Nov 2016 07:37:15 +0000 (08:37 +0100)
Makefile.am
src/test/test-execute.c
test/test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service [new file with mode: 0644]
test/test-execute/exec-dynamicuser-fixeduser.service [new file with mode: 0644]

index 34c2f60330d0eb59e610973598c913dea24521dd..3226ea4549308590aeddefdbc018e6f0569d698d 100644 (file)
@@ -1626,6 +1626,8 @@ EXTRA_DIST += \
        test/test-execute/exec-supplementarygroups-multiple-groups-default-group-user.service \
        test/test-execute/exec-supplementarygroups-multiple-groups-withgid.service \
        test/test-execute/exec-supplementarygroups-multiple-groups-withuid.service \
+       test/test-execute/exec-dynamicuser-fixeduser.service \
+       test/test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service \
        test/test-execute/exec-ignoresigpipe-no.service \
        test/test-execute/exec-ignoresigpipe-yes.service \
        test/test-execute/exec-personality-x86-64.service \
index c3690985000764f317f61ea20cf46d1708624b72..aa5a9f1695c22c065ac30a3d8cab6de652eaa52d 100644 (file)
@@ -259,6 +259,11 @@ static void test_exec_supplementary_groups(Manager *m) {
         test(m, "exec-supplementarygroups-multiple-groups-withuid.service", 0, CLD_EXITED);
 }
 
+static void test_exec_dynamic_user(Manager *m) {
+        test(m, "exec-dynamicuser-fixeduser.service", 0, CLD_EXITED);
+        test(m, "exec-dynamicuser-fixeduser-one-supplementarygroup.service", 0, CLD_EXITED);
+}
+
 static void test_exec_environment(Manager *m) {
         test(m, "exec-environment.service", 0, CLD_EXITED);
         test(m, "exec-environment-multiple.service", 0, CLD_EXITED);
@@ -432,6 +437,7 @@ int main(int argc, char *argv[]) {
                 test_exec_user,
                 test_exec_group,
                 test_exec_supplementary_groups,
+                test_exec_dynamic_user,
                 test_exec_environment,
                 test_exec_environmentfile,
                 test_exec_passenvironment,
diff --git a/test/test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service b/test/test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service
new file mode 100644 (file)
index 0000000..de1a6e7
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=Test DynamicUser with User= and SupplementaryGroups=
+
+[Service]
+ExecStart=/bin/sh -x -c 'test "$$(id -G)" = "1" && test "$$(id -g)" = "1" && test "$$(id -u)" = "1"'
+Type=oneshot
+User=1
+DynamicUser=yes
+SupplementaryGroups=1
diff --git a/test/test-execute/exec-dynamicuser-fixeduser.service b/test/test-execute/exec-dynamicuser-fixeduser.service
new file mode 100644 (file)
index 0000000..1d84af0
--- /dev/null
@@ -0,0 +1,8 @@
+[Unit]
+Description=Test DynamicUser with User=
+
+[Service]
+ExecStart=/bin/sh -x -c 'test "$$(id -G)" = "1" && test "$$(id -g)" = "1" && test "$$(id -u)" = "1"'
+Type=oneshot
+User=1
+DynamicUser=yes