summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2017-12-03 14:27:32 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2017-12-06 00:37:09 +0900
commit028f3a7f9c75161c0b38be4e690a5b45d4d7b1c1 (patch)
treeb848ae90abd9a4fc0116d6a72ec2b908d5686c7f /test
parentf0e018e748cd48b8959160b160fdd85827afd5bf (diff)
downloadsystemd-028f3a7f9c75161c0b38be4e690a5b45d4d7b1c1.tar.gz
systemd-028f3a7f9c75161c0b38be4e690a5b45d4d7b1c1.tar.bz2
systemd-028f3a7f9c75161c0b38be4e690a5b45d4d7b1c1.zip
test-execute: add test for that DynamicUser= migrate StateDirectory=
Test for 949befd3f09e8c06a908ec99efd241666c21d944.
Diffstat (limited to 'test')
-rw-r--r--test/meson.build2
-rw-r--r--test/test-execute/exec-dynamicuser-statedir-migrate-step1.service16
-rw-r--r--test/test-execute/exec-dynamicuser-statedir-migrate-step2.service24
3 files changed, 42 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build
index cd00186266..c50757a46b 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -56,6 +56,8 @@ test_data_files = '''
test-execute/exec-capabilityboundingset-simple.service
test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service
test-execute/exec-dynamicuser-fixeduser.service
+ test-execute/exec-dynamicuser-statedir-migrate-step1.service
+ test-execute/exec-dynamicuser-statedir-migrate-step2.service
test-execute/exec-dynamicuser-statedir.service
test-execute/exec-dynamicuser-supplementarygroups.service
test-execute/exec-environment-empty.service
diff --git a/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service b/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service
new file mode 100644
index 0000000000..83bdfb311a
--- /dev/null
+++ b/test/test-execute/exec-dynamicuser-statedir-migrate-step1.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Test DynamicUser= migrate StateDirectory= (preparation)
+
+[Service]
+ExecStart=/bin/sh -c 'test -w /var/lib/test-dynamicuser-migrate'
+ExecStart=/bin/sh -c 'test -w /var/lib/test-dynamicuser-migrate2/hoge'
+ExecStart=/bin/sh -c 'test ! -L /var/lib/test-dynamicuser-migrate'
+ExecStart=/bin/sh -c 'test ! -L /var/lib/test-dynamicuser-migrate2/hoge'
+ExecStart=/bin/sh -c 'test -d /var/lib/test-dynamicuser-migrate'
+ExecStart=/bin/sh -c 'test -d /var/lib/test-dynamicuser-migrate2/hoge'
+ExecStart=/bin/sh -c 'touch /var/lib/test-dynamicuser-migrate/yay'
+ExecStart=/bin/sh -c 'touch /var/lib/test-dynamicuser-migrate2/hoge/yayyay'
+
+Type=oneshot
+DynamicUser=no
+StateDirectory=test-dynamicuser-migrate test-dynamicuser-migrate2/hoge
diff --git a/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service b/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service
new file mode 100644
index 0000000000..8154922a2f
--- /dev/null
+++ b/test/test-execute/exec-dynamicuser-statedir-migrate-step2.service
@@ -0,0 +1,24 @@
+[Unit]
+Description=Test DynamicUser= migrate StateDirectory= (preparation)
+
+[Service]
+ExecStart=/bin/sh -c 'test -w /var/lib/test-dynamicuser-migrate'
+ExecStart=/bin/sh -c 'test -w /var/lib/test-dynamicuser-migrate2/hoge'
+ExecStart=/bin/sh -c 'test -L /var/lib/test-dynamicuser-migrate'
+ExecStart=/bin/sh -c 'test -L /var/lib/test-dynamicuser-migrate2/hoge'
+ExecStart=/bin/sh -c 'test -d /var/lib/test-dynamicuser-migrate'
+ExecStart=/bin/sh -c 'test -d /var/lib/test-dynamicuser-migrate2/hoge'
+ExecStart=/bin/sh -c 'test -f /var/lib/test-dynamicuser-migrate/yay'
+ExecStart=/bin/sh -c 'test -f /var/lib/test-dynamicuser-migrate2/hoge/yayyay'
+ExecStart=/bin/sh -c 'test -d /var/lib/private/test-dynamicuser-migrate'
+ExecStart=/bin/sh -c 'test -d /var/lib/private/test-dynamicuser-migrate2/hoge'
+ExecStart=/bin/sh -c 'test -f /var/lib/private/test-dynamicuser-migrate/yay'
+ExecStart=/bin/sh -c 'test -f /var/lib/private/test-dynamicuser-migrate2/hoge/yayyay'
+ExecStart=/bin/sh -c 'touch /var/lib/test-dynamicuser-migrate/yay'
+ExecStart=/bin/sh -c 'touch /var/lib/test-dynamicuser-migrate2/hoge/yayyay'
+ExecStart=/bin/sh -c 'touch /var/lib/private/test-dynamicuser-migrate/yay'
+ExecStart=/bin/sh -c 'touch /var/lib/private/test-dynamicuser-migrate2/hoge/yayyay'
+
+Type=oneshot
+DynamicUser=yes
+StateDirectory=test-dynamicuser-migrate test-dynamicuser-migrate2/hoge