mirror of
https://github.com/systemd/systemd.git
synced 2025-02-28 05:57:33 +03:00
tests: make inverted tests actually count
"! test ..." does not cause the script to fail, even with set -e. IIUC, bash treats this command as part of an expression line, as it would if 'test ... && ...' was used. Failing expression lines do not terminate the script. This fixes the obvious cases by changing '! test' → 'test !'. Then the inversion happens internally in test and bash will propagate the failure.
This commit is contained in:
parent
65d09d575c
commit
ffa328f060
@ -10,4 +10,4 @@ rm -fr /tmp/test
|
||||
|
||||
echo "e /tmp/test - root root 1d" | systemd-tmpfiles --create -
|
||||
|
||||
! test -e /tmp/test
|
||||
test ! -e /tmp/test
|
||||
|
@ -63,7 +63,7 @@ e /tmp/e/1 0755 daemon daemon - -
|
||||
e /tmp/e/2/* 0755 daemon daemon - -
|
||||
EOF
|
||||
|
||||
! test -d /tmp/e/1
|
||||
test ! -d /tmp/e/1
|
||||
|
||||
test -d /tmp/e/2
|
||||
test $(stat -c %U:%G:%a /tmp/e/2) = "root:root:777"
|
||||
|
@ -19,7 +19,7 @@ f /tmp/f/2 0644 - - - This string should be written
|
||||
EOF
|
||||
|
||||
### '1' should exist and be empty
|
||||
test -f /tmp/f/1; ! test -s /tmp/f/1
|
||||
test -f /tmp/f/1; test ! -s /tmp/f/1
|
||||
test $(stat -c %U:%G:%a /tmp/f/1) = "root:root:644"
|
||||
|
||||
test $(stat -c %U:%G:%a /tmp/f/2) = "root:root:644"
|
||||
@ -31,7 +31,7 @@ f /tmp/f/1 0666 daemon daemon - This string should not be written
|
||||
EOF
|
||||
|
||||
# file should be empty
|
||||
! test -s /tmp/f/1
|
||||
test ! -s /tmp/f/1
|
||||
test $(stat -c %U:%G:%a /tmp/f/1) = "daemon:daemon:666"
|
||||
|
||||
### But we shouldn't try to set perms on an existing file which is not a
|
||||
@ -54,7 +54,7 @@ ln -s /tmp/file-owned-by-root /tmp/f/symlink
|
||||
f /tmp/f/dangling 0644 daemon daemon - -
|
||||
f /tmp/f/symlink 0644 daemon daemon - -
|
||||
EOF
|
||||
! test -e /tmp/f/missing
|
||||
test ! -e /tmp/f/missing
|
||||
test $(stat -c %U:%G:%a /tmp/file-owned-by-root) = "root:root:644"
|
||||
|
||||
### Handle read-only filesystem gracefully: we shouldn't fail if the target
|
||||
@ -70,7 +70,7 @@ mount -o bind,ro /tmp/f/rw-fs /tmp/f/ro-fs
|
||||
systemd-tmpfiles --create - <<EOF
|
||||
f /tmp/f/ro-fs/foo 0644 - - - - This string should not be written
|
||||
EOF
|
||||
test -f /tmp/f/ro-fs/foo; ! test -s /tmp/f/ro-fs/foo
|
||||
test -f /tmp/f/ro-fs/foo; test ! -s /tmp/f/ro-fs/foo
|
||||
|
||||
! systemd-tmpfiles --create - <<EOF
|
||||
f /tmp/f/ro-fs/foo 0666 - - - -
|
||||
@ -80,7 +80,7 @@ test $(stat -c %U:%G:%a /tmp/f/fifo) = "root:root:644"
|
||||
! systemd-tmpfiles --create - <<EOF
|
||||
f /tmp/f/ro-fs/bar 0644 - - - -
|
||||
EOF
|
||||
! test -e /tmp/f/ro-fs/bar
|
||||
test ! -e /tmp/f/ro-fs/bar
|
||||
|
||||
### 'f' shouldn't follow unsafe paths.
|
||||
mkdir /tmp/f/daemon
|
||||
@ -90,7 +90,7 @@ chown -R --no-dereference daemon:daemon /tmp/f/daemon
|
||||
! systemd-tmpfiles --create - <<EOF
|
||||
f /tmp/f/daemon/unsafe-symlink/exploit 0644 daemon daemon - -
|
||||
EOF
|
||||
! test -e /tmp/f/daemon/unsafe-symlink/exploit
|
||||
test ! -e /tmp/f/daemon/unsafe-symlink/exploit
|
||||
|
||||
#
|
||||
# 'F'
|
||||
@ -105,10 +105,10 @@ F /tmp/F/truncated 0666 daemon daemon - -
|
||||
F /tmp/F/truncated-with-content 0666 daemon daemon - new content
|
||||
EOF
|
||||
|
||||
test -f /tmp/F/created; ! test -s /tmp/F/created
|
||||
test -f /tmp/F/created; test ! -s /tmp/F/created
|
||||
test -f /tmp/F/created-with-content
|
||||
test "$(< /tmp/F/created-with-content)" = "new content"
|
||||
test -f /tmp/F/truncated; ! test -s /tmp/F/truncated
|
||||
test -f /tmp/F/truncated; test ! -s /tmp/F/truncated
|
||||
test $(stat -c %U:%G:%a /tmp/F/truncated) = "daemon:daemon:666"
|
||||
test -s /tmp/F/truncated-with-content
|
||||
test $(stat -c %U:%G:%a /tmp/F/truncated-with-content) = "daemon:daemon:666"
|
||||
@ -131,7 +131,7 @@ ln -s /tmp/file-owned-by-root /tmp/F/symlink
|
||||
f /tmp/F/dangling 0644 daemon daemon - -
|
||||
f /tmp/F/symlink 0644 daemon daemon - -
|
||||
EOF
|
||||
! test -e /tmp/F/missing
|
||||
test ! -e /tmp/F/missing
|
||||
test $(stat -c %U:%G:%a /tmp/file-owned-by-root) = "root:root:644"
|
||||
|
||||
### Handle read-only filesystem gracefully: we shouldn't fail if the target
|
||||
@ -147,7 +147,7 @@ mount -o bind,ro /tmp/F/rw-fs /tmp/F/ro-fs
|
||||
systemd-tmpfiles --create - <<EOF
|
||||
F /tmp/F/ro-fs/foo 0644 - - - -
|
||||
EOF
|
||||
test -f /tmp/F/ro-fs/foo; ! test -s /tmp/F/ro-fs/foo
|
||||
test -f /tmp/F/ro-fs/foo; test ! -s /tmp/F/ro-fs/foo
|
||||
|
||||
echo "truncating is not allowed anymore" >/tmp/F/rw-fs/foo
|
||||
! systemd-tmpfiles --create - <<EOF
|
||||
@ -157,7 +157,7 @@ EOF
|
||||
! systemd-tmpfiles --create - <<EOF
|
||||
F /tmp/F/ro-fs/foo 0644 - - - - This string should not be written
|
||||
EOF
|
||||
test -f /tmp/F/ro-fs/foo; ! test -s /tmp/F/ro-fs/foo
|
||||
test -f /tmp/F/ro-fs/foo; test ! -s /tmp/F/ro-fs/foo
|
||||
|
||||
# Trying to change the perms should fail.
|
||||
>/tmp/F/rw-fs/foo
|
||||
@ -170,7 +170,7 @@ test $(stat -c %U:%G:%a /tmp/F/ro-fs/foo) = "root:root:644"
|
||||
! systemd-tmpfiles --create - <<EOF
|
||||
F /tmp/F/ro-fs/bar 0644 - - - -
|
||||
EOF
|
||||
! test -e /tmp/F/ro-fs/bar
|
||||
test ! -e /tmp/F/ro-fs/bar
|
||||
|
||||
### 'F' shouldn't follow unsafe paths.
|
||||
mkdir /tmp/F/daemon
|
||||
@ -180,7 +180,7 @@ chown -R --no-dereference daemon:daemon /tmp/F/daemon
|
||||
! systemd-tmpfiles --create - <<EOF
|
||||
F /tmp/F/daemon/unsafe-symlink/exploit 0644 daemon daemon - -
|
||||
EOF
|
||||
! test -e /tmp/F/daemon/unsafe-symlink/exploit
|
||||
test ! -e /tmp/F/daemon/unsafe-symlink/exploit
|
||||
|
||||
#
|
||||
# 'w'
|
||||
@ -191,7 +191,7 @@ touch /tmp/w/overwritten
|
||||
systemd-tmpfiles --create - <<EOF
|
||||
w /tmp/w/unexistent 0644 - - - new content
|
||||
EOF
|
||||
! test -e /tmp/w/unexistent
|
||||
test ! -e /tmp/w/unexistent
|
||||
|
||||
### no argument given -> fails.
|
||||
! systemd-tmpfiles --create - <<EOF
|
||||
@ -233,4 +233,4 @@ chown -R --no-dereference daemon:daemon /tmp/w/daemon
|
||||
! systemd-tmpfiles --create - <<EOF
|
||||
f /tmp/w/daemon/unsafe-symlink/exploit 0644 daemon daemon - -
|
||||
EOF
|
||||
! test -e /tmp/w/daemon/unsafe-symlink/exploit
|
||||
test ! -e /tmp/w/daemon/unsafe-symlink/exploit
|
||||
|
@ -18,8 +18,8 @@ test -d /var/tmp/foobar-test-06
|
||||
test -d /var/tmp/foobar-test-06/important
|
||||
|
||||
test_snippet --remove
|
||||
! test -f /var/tmp/foobar-test-06
|
||||
! test -f /var/tmp/foobar-test-06/important
|
||||
test ! -f /var/tmp/foobar-test-06
|
||||
test ! -f /var/tmp/foobar-test-06/important
|
||||
|
||||
test_snippet --create
|
||||
test -d /var/tmp/foobar-test-06
|
||||
@ -35,4 +35,4 @@ test -f /var/tmp/foobar-test-06/something-else
|
||||
test_snippet --create --remove
|
||||
test -d /var/tmp/foobar-test-06
|
||||
test -d /var/tmp/foobar-test-06/important
|
||||
! test -f /var/tmp/foobar-test-06/something-else
|
||||
test ! -f /var/tmp/foobar-test-06/something-else
|
||||
|
@ -16,8 +16,8 @@ r /tmp/test-prefix
|
||||
r /tmp/test-prefix/file
|
||||
EOF
|
||||
|
||||
! test -f /tmp/test-prefix/file
|
||||
! test -f /tmp/test-prefix
|
||||
test ! -f /tmp/test-prefix/file
|
||||
test ! -f /tmp/test-prefix
|
||||
|
||||
mkdir /tmp/test-prefix
|
||||
touch /tmp/test-prefix/file
|
||||
@ -27,5 +27,5 @@ r /tmp/test-prefix/file
|
||||
r /tmp/test-prefix
|
||||
EOF
|
||||
|
||||
! test -f /tmp/test-prefix/file
|
||||
! test -f /tmp/test-prefix
|
||||
test ! -f /tmp/test-prefix/file
|
||||
test ! -f /tmp/test-prefix
|
||||
|
@ -23,9 +23,9 @@ test -d /tmp/root/test2
|
||||
# unprivileged user's directory when it's not part of the prefix, as expected
|
||||
# by the unsafe_transition function.
|
||||
! echo 'd /tmp/user/root/test' | systemd-tmpfiles --create -
|
||||
! test -e /tmp/user/root/test
|
||||
test ! -e /tmp/user/root/test
|
||||
! echo 'd /user/root/test' | systemd-tmpfiles --root=/tmp --create -
|
||||
! test -e /tmp/user/root/test
|
||||
test ! -e /tmp/user/root/test
|
||||
|
||||
# Verify the above works when all user-owned directories are in the prefix.
|
||||
echo 'd /test' | systemd-tmpfiles --root=/tmp/user/root --create -
|
||||
|
@ -34,7 +34,7 @@ cmp /var/tmp/testimage.raw /var/lib/machines/testimage3.raw
|
||||
|
||||
# Test removal
|
||||
machinectl remove testimage
|
||||
! test -f /var/lib/machines/testimage.raw
|
||||
test ! -f /var/lib/machines/testimage.raw
|
||||
! machinectl image-status testimage
|
||||
|
||||
# Test export of clone
|
||||
@ -46,7 +46,7 @@ rm /var/tmp/testimage3.raw
|
||||
machinectl rename testimage3 testimage4
|
||||
test -f /var/lib/machines/testimage4.raw
|
||||
machinectl image-status testimage4
|
||||
! test -f /var/lib/machines/testimage3.raw
|
||||
test ! -f /var/lib/machines/testimage3.raw
|
||||
! machinectl image-status testimage3
|
||||
cmp /var/tmp/testimage.raw /var/lib/machines/testimage4.raw
|
||||
|
||||
@ -57,7 +57,7 @@ rm /var/tmp/testimage4.raw
|
||||
|
||||
# Test removal
|
||||
machinectl remove testimage4
|
||||
! test -f /var/lib/machines/testimage4.raw
|
||||
test ! -f /var/lib/machines/testimage4.raw
|
||||
! machinectl image-status testimage4
|
||||
|
||||
# → And now, let's test directory trees ← #
|
||||
@ -90,7 +90,7 @@ diff -r /var/tmp/scratch/ /var/lib/machines/scratch2
|
||||
|
||||
# Test removal
|
||||
machinectl remove scratch
|
||||
! test -f /var/lib/machines/scratch
|
||||
test ! -f /var/lib/machines/scratch
|
||||
! machinectl image-status scratch
|
||||
|
||||
# Test clone
|
||||
@ -103,20 +103,20 @@ diff -r /var/tmp/scratch/ /var/lib/machines/scratch3
|
||||
|
||||
# Test removal
|
||||
machinectl remove scratch2
|
||||
! test -f /var/lib/machines/scratch2
|
||||
test ! -f /var/lib/machines/scratch2
|
||||
! machinectl image-status scratch2
|
||||
|
||||
# Test rename
|
||||
machinectl rename scratch3 scratch4
|
||||
test -d /var/lib/machines/scratch4
|
||||
machinectl image-status scratch4
|
||||
! test -f /var/lib/machines/scratch3
|
||||
test ! -f /var/lib/machines/scratch3
|
||||
! machinectl image-status scratch3
|
||||
diff -r /var/tmp/scratch/ /var/lib/machines/scratch4
|
||||
|
||||
# Test removal
|
||||
machinectl remove scratch4
|
||||
! test -f /var/lib/machines/scratch4
|
||||
test ! -f /var/lib/machines/scratch4
|
||||
! machinectl image-status scratch4
|
||||
|
||||
# Test import-tar hyphen/stdin pipe behavior
|
||||
@ -135,7 +135,7 @@ rm -rf /var/tmp/scratch
|
||||
|
||||
# Test removal
|
||||
machinectl remove scratch5
|
||||
! test -f /var/lib/machines/scratch5
|
||||
test ! -f /var/lib/machines/scratch5
|
||||
! machinectl image-status scratch5
|
||||
|
||||
echo OK > /testok
|
||||
|
@ -13,16 +13,16 @@ timedatectl set-time 1980-10-15
|
||||
systemd-run --on-timezone-change touch /tmp/timezone-changed
|
||||
systemd-run --on-clock-change touch /tmp/clock-changed
|
||||
|
||||
! test -f /tmp/timezone-changed
|
||||
! test -f /tmp/clock-changed
|
||||
test ! -f /tmp/timezone-changed
|
||||
test ! -f /tmp/clock-changed
|
||||
|
||||
timedatectl set-timezone Europe/Kiev
|
||||
|
||||
while ! test -f /tmp/timezone-changed ; do sleep .5 ; done
|
||||
while test ! -f /tmp/timezone-changed ; do sleep .5 ; done
|
||||
|
||||
timedatectl set-time 2018-1-1
|
||||
|
||||
while ! test -f /tmp/clock-changed ; do sleep .5 ; done
|
||||
while test ! -f /tmp/clock-changed ; do sleep .5 ; done
|
||||
|
||||
systemd-analyze log-level info
|
||||
|
||||
|
@ -18,11 +18,11 @@ 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
|
||||
test ! -e /etc/testservice
|
||||
test ! -e /run/testservice
|
||||
test ! -e /var/lib/testservice
|
||||
test ! -e /var/cache/testservice
|
||||
test ! -e /var/log/testservice
|
||||
|
||||
systemctl start testservice
|
||||
|
||||
@ -44,7 +44,7 @@ test -d /var/log/testservice
|
||||
|
||||
systemctl clean testservice --what=configuration
|
||||
|
||||
! test -e /etc/testservice
|
||||
test ! -e /etc/testservice
|
||||
test -d /run/testservice
|
||||
test -d /var/lib/testservice
|
||||
test -d /var/cache/testservice
|
||||
@ -52,27 +52,27 @@ test -d /var/log/testservice
|
||||
|
||||
systemctl clean testservice
|
||||
|
||||
! test -e /etc/testservice
|
||||
! test -e /run/testservice
|
||||
test ! -e /etc/testservice
|
||||
test ! -e /run/testservice
|
||||
test -d /var/lib/testservice
|
||||
! test -e /var/cache/testservice
|
||||
test ! -e /var/cache/testservice
|
||||
test -d /var/log/testservice
|
||||
|
||||
systemctl clean testservice --what=logs
|
||||
|
||||
! test -e /etc/testservice
|
||||
! test -e /run/testservice
|
||||
test ! -e /etc/testservice
|
||||
test ! -e /run/testservice
|
||||
test -d /var/lib/testservice
|
||||
! test -e /var/cache/testservice
|
||||
! test -e /var/log/testservice
|
||||
test ! -e /var/cache/testservice
|
||||
test ! -e /var/log/testservice
|
||||
|
||||
systemctl clean testservice --what=all
|
||||
|
||||
! test -e /etc/testservice
|
||||
! test -e /run/testservice
|
||||
! test -e /var/lib/testservice
|
||||
! test -e /var/cache/testservice
|
||||
! test -e /var/log/testservice
|
||||
test ! -e /etc/testservice
|
||||
test ! -e /run/testservice
|
||||
test ! -e /var/lib/testservice
|
||||
test ! -e /var/cache/testservice
|
||||
test ! -e /var/log/testservice
|
||||
|
||||
cat > /etc/systemd/system/testservice.service <<EOF
|
||||
[Service]
|
||||
@ -89,11 +89,11 @@ 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
|
||||
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
|
||||
|
||||
@ -123,7 +123,7 @@ test -L /var/log/testservice
|
||||
|
||||
systemctl clean testservice --what=configuration
|
||||
|
||||
! test -d /etc/testservice
|
||||
test ! -d /etc/testservice
|
||||
test -d /run/private/testservice
|
||||
test -d /var/lib/private/testservice
|
||||
test -d /var/cache/private/testservice
|
||||
@ -135,39 +135,39 @@ test -L /var/log/testservice
|
||||
|
||||
systemctl clean testservice
|
||||
|
||||
! test -d /etc/testservice
|
||||
! test -d /run/private/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/cache/private/testservice
|
||||
test -d /var/log/private/testservice
|
||||
! test -L /run/testservice
|
||||
test ! -L /run/testservice
|
||||
test -L /var/lib/testservice
|
||||
! test -L /var/cache/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 /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 ! -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
|
||||
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
|
||||
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
|
||||
|
||||
cat > /etc/systemd/system/tmp-hoge.mount <<EOF
|
||||
[Mount]
|
||||
@ -182,11 +182,11 @@ EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
! test -e /etc/hoge
|
||||
! test -e /run/hoge
|
||||
! test -e /var/lib/hoge
|
||||
! test -e /var/cache/hoge
|
||||
! test -e /var/log/hoge
|
||||
test ! -e /etc/hoge
|
||||
test ! -e /run/hoge
|
||||
test ! -e /var/lib/hoge
|
||||
test ! -e /var/cache/hoge
|
||||
test ! -e /var/log/hoge
|
||||
|
||||
systemctl start tmp-hoge.mount
|
||||
|
||||
@ -207,42 +207,42 @@ test -d /var/log/hoge
|
||||
systemctl stop tmp-hoge.mount
|
||||
|
||||
test -d /etc/hoge
|
||||
! test -d /run/hoge
|
||||
test ! -d /run/hoge
|
||||
test -d /var/lib/hoge
|
||||
test -d /var/cache/hoge
|
||||
test -d /var/log/hoge
|
||||
|
||||
systemctl clean tmp-hoge.mount --what=configuration
|
||||
|
||||
! test -d /etc/hoge
|
||||
! test -d /run/hoge
|
||||
test ! -d /etc/hoge
|
||||
test ! -d /run/hoge
|
||||
test -d /var/lib/hoge
|
||||
test -d /var/cache/hoge
|
||||
test -d /var/log/hoge
|
||||
|
||||
systemctl clean tmp-hoge.mount
|
||||
|
||||
! test -d /etc/hoge
|
||||
! test -d /run/hoge
|
||||
test ! -d /etc/hoge
|
||||
test ! -d /run/hoge
|
||||
test -d /var/lib/hoge
|
||||
! test -d /var/cache/hoge
|
||||
test ! -d /var/cache/hoge
|
||||
test -d /var/log/hoge
|
||||
|
||||
systemctl clean tmp-hoge.mount --what=logs
|
||||
|
||||
! test -d /etc/hoge
|
||||
! test -d /run/hoge
|
||||
test ! -d /etc/hoge
|
||||
test ! -d /run/hoge
|
||||
test -d /var/lib/hoge
|
||||
! test -d /var/cache/hoge
|
||||
! test -d /var/log/hoge
|
||||
test ! -d /var/cache/hoge
|
||||
test ! -d /var/log/hoge
|
||||
|
||||
systemctl clean tmp-hoge.mount --what=all
|
||||
|
||||
! test -d /etc/hoge
|
||||
! test -d /run/hoge
|
||||
! test -d /var/lib/hoge
|
||||
! test -d /var/cache/hoge
|
||||
! test -d /var/log/hoge
|
||||
test ! -d /etc/hoge
|
||||
test ! -d /run/hoge
|
||||
test ! -d /var/lib/hoge
|
||||
test ! -d /var/cache/hoge
|
||||
test ! -d /var/log/hoge
|
||||
|
||||
cat > /etc/systemd/system/testservice.socket <<EOF
|
||||
[Socket]
|
||||
@ -258,16 +258,16 @@ EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
! test -e /etc/testsocket
|
||||
! test -e /run/testsocket
|
||||
! test -e /var/lib/testsocket
|
||||
! test -e /var/cache/testsocket
|
||||
! test -e /var/log/testsocket
|
||||
test ! -e /etc/testsocket
|
||||
test ! -e /run/testsocket
|
||||
test ! -e /var/lib/testsocket
|
||||
test ! -e /var/cache/testsocket
|
||||
test ! -e /var/log/testsocket
|
||||
|
||||
systemctl start testservice.socket
|
||||
|
||||
test -d /etc/testsocket
|
||||
! test -d /run/testsocket
|
||||
test ! -d /run/testsocket
|
||||
test -d /var/lib/testsocket
|
||||
test -d /var/cache/testsocket
|
||||
test -d /var/log/testsocket
|
||||
@ -277,42 +277,42 @@ test -d /var/log/testsocket
|
||||
systemctl stop testservice.socket
|
||||
|
||||
test -d /etc/testsocket
|
||||
! test -d /run/testsocket
|
||||
test ! -d /run/testsocket
|
||||
test -d /var/lib/testsocket
|
||||
test -d /var/cache/testsocket
|
||||
test -d /var/log/testsocket
|
||||
|
||||
systemctl clean testservice.socket --what=configuration
|
||||
|
||||
! test -e /etc/testsocket
|
||||
! test -d /run/testsocket
|
||||
test ! -e /etc/testsocket
|
||||
test ! -d /run/testsocket
|
||||
test -d /var/lib/testsocket
|
||||
test -d /var/cache/testsocket
|
||||
test -d /var/log/testsocket
|
||||
|
||||
systemctl clean testservice.socket
|
||||
|
||||
! test -e /etc/testsocket
|
||||
! test -e /run/testsocket
|
||||
test ! -e /etc/testsocket
|
||||
test ! -e /run/testsocket
|
||||
test -d /var/lib/testsocket
|
||||
! test -e /var/cache/testsocket
|
||||
test ! -e /var/cache/testsocket
|
||||
test -d /var/log/testsocket
|
||||
|
||||
systemctl clean testservice.socket --what=logs
|
||||
|
||||
! test -e /etc/testsocket
|
||||
! test -e /run/testsocket
|
||||
test ! -e /etc/testsocket
|
||||
test ! -e /run/testsocket
|
||||
test -d /var/lib/testsocket
|
||||
! test -e /var/cache/testsocket
|
||||
! test -e /var/log/testsocket
|
||||
test ! -e /var/cache/testsocket
|
||||
test ! -e /var/log/testsocket
|
||||
|
||||
systemctl clean testservice.socket --what=all
|
||||
|
||||
! test -e /etc/testsocket
|
||||
! test -e /run/testsocket
|
||||
! test -e /var/lib/testsocket
|
||||
! test -e /var/cache/testsocket
|
||||
! test -e /var/log/testsocket
|
||||
test ! -e /etc/testsocket
|
||||
test ! -e /run/testsocket
|
||||
test ! -e /var/lib/testsocket
|
||||
test ! -e /var/cache/testsocket
|
||||
test ! -e /var/log/testsocket
|
||||
|
||||
echo OK > /testok
|
||||
|
||||
|
@ -12,10 +12,10 @@ systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/t
|
||||
! systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing
|
||||
|
||||
test -d /var/lib/zzz
|
||||
! test -L /var/lib/zzz
|
||||
! test -e /var/lib/private/zzz
|
||||
test ! -L /var/lib/zzz
|
||||
test ! -e /var/lib/private/zzz
|
||||
test -f /var/lib/zzz/test
|
||||
! test -f /var/lib/zzz/test-missing
|
||||
test ! -f /var/lib/zzz/test-missing
|
||||
|
||||
# Convert to DynamicUser=1
|
||||
|
||||
@ -26,7 +26,7 @@ test -L /var/lib/zzz
|
||||
test -d /var/lib/private/zzz
|
||||
|
||||
test -f /var/lib/zzz/test
|
||||
! test -f /var/lib/zzz/test-missing
|
||||
test ! -f /var/lib/zzz/test-missing
|
||||
|
||||
# Convert back
|
||||
|
||||
@ -34,10 +34,10 @@ systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/t
|
||||
! systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing
|
||||
|
||||
test -d /var/lib/zzz
|
||||
! test -L /var/lib/zzz
|
||||
! test -e /var/lib/private/zzz
|
||||
test ! -L /var/lib/zzz
|
||||
test ! -e /var/lib/private/zzz
|
||||
test -f /var/lib/zzz/test
|
||||
! test -f /var/lib/zzz/test-missing
|
||||
test ! -f /var/lib/zzz/test-missing
|
||||
|
||||
systemd-analyze log-level info
|
||||
|
||||
|
@ -12,7 +12,7 @@ touch /tmp/aaa/bbb
|
||||
systemctl restart tmp-aaa.mount
|
||||
|
||||
test -e /run/hoge/foo
|
||||
! test -e /tmp/aaa/bbb
|
||||
test ! -e /tmp/aaa/bbb
|
||||
|
||||
echo OK > /testok
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user