diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-08-25 16:27:33 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-08-28 23:09:54 +0900 |
commit | c238b616cf11ec36040a0db30faf54e63006b4a4 (patch) | |
tree | 4fcec4265ea631cf068d3d38a78cf9bcf0766738 /test/TEST-33-CLEAN-UNIT | |
parent | 7f622a19d94210c73c2c13857f0f361b87876893 (diff) | |
download | systemd-c238b616cf11ec36040a0db30faf54e63006b4a4.tar.gz |
test: add tests for systemctl clean with DynamicUser=yes
Diffstat (limited to 'test/TEST-33-CLEAN-UNIT')
-rwxr-xr-x | test/TEST-33-CLEAN-UNIT/testsuite.sh | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/test/TEST-33-CLEAN-UNIT/testsuite.sh b/test/TEST-33-CLEAN-UNIT/testsuite.sh index 15aa687238..26754f01ba 100755 --- a/test/TEST-33-CLEAN-UNIT/testsuite.sh +++ b/test/TEST-33-CLEAN-UNIT/testsuite.sh @@ -74,6 +74,101 @@ systemctl clean testservice --what=all ! test -e /var/cache/testservice ! test -e /var/log/testservice +cat > /etc/systemd/system/testservice.service <<EOF +[Service] +DynamicUser=yes +ConfigurationDirectory=testservice +RuntimeDirectory=testservice +StateDirectory=testservice +CacheDirectory=testservice +LogsDirectory=testservice +RuntimeDirectoryPreserve=yes +ExecStart=/bin/sleep infinity +Type=exec +EOF + +systemctl daemon-reload + +! test -e /etc/testservice +! test -e /run/testservice +! test -e /var/lib/testservice +! test -e /var/cache/testservice +! test -e /var/log/testservice + +systemctl restart testservice + +test -d /etc/testservice +test -d /run/private/testservice +test -d /var/lib/private/testservice +test -d /var/cache/private/testservice +test -d /var/log/private/testservice +test -L /run/testservice +test -L /var/lib/testservice +test -L /var/cache/testservice +test -L /var/log/testservice + +! systemctl clean testservice + +systemctl stop testservice + +test -d /etc/testservice +test -d /run/private/testservice +test -d /var/lib/private/testservice +test -d /var/cache/private/testservice +test -d /var/log/private/testservice +test -L /run/testservice +test -L /var/lib/testservice +test -L /var/cache/testservice +test -L /var/log/testservice + +systemctl clean testservice --what=configuration + +! test -d /etc/testservice +test -d /run/private/testservice +test -d /var/lib/private/testservice +test -d /var/cache/private/testservice +test -d /var/log/private/testservice +test -L /run/testservice +test -L /var/lib/testservice +test -L /var/cache/testservice +test -L /var/log/testservice + +systemctl clean testservice + +! test -d /etc/testservice +! test -d /run/private/testservice +test -d /var/lib/private/testservice +! test -d /var/cache/private/testservice +test -d /var/log/private/testservice +! test -L /run/testservice +test -L /var/lib/testservice +! test -L /var/cache/testservice +test -L /var/log/testservice + +systemctl clean testservice --what=logs + +! test -d /etc/testservice +! test -d /run/private/testservice +test -d /var/lib/private/testservice +! test -d /var/cache/private/testservice +! test -d /var/log/private/testservice +! test -L /run/testservice +test -L /var/lib/testservice +! test -L /var/cache/testservice +! test -L /var/log/testservice + +systemctl clean testservice --what=all + +! test -d /etc/testservice +! test -d /run/private/testservice +! test -d /var/lib/private/testservice +! test -d /var/cache/private/testservice +! test -d /var/log/private/testservice +! test -L /run/testservice +! test -L /var/lib/testservice +! test -L /var/cache/testservice +! test -L /var/log/testservice + echo OK > /testok exit 0 |