summaryrefslogtreecommitdiffstats
path: root/test/units/TEST-22-TMPFILES.18.sh
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-09-12 18:23:06 +0200
committerLennart Poettering <lennart@poettering.net>2024-09-15 19:43:09 +0200
commitdb15657dfb8100c3c6cd8cf60fa68521e019d47a (patch)
treecbf9e89a27969fda9423c31cb57d70742d74de15 /test/units/TEST-22-TMPFILES.18.sh
parentman/bootup: rename initrd to exitrd at one more place (diff)
downloadsystemd-db15657dfb8100c3c6cd8cf60fa68521e019d47a.tar.xz
systemd-db15657dfb8100c3c6cd8cf60fa68521e019d47a.zip
tmpfiles: introduce an explicit line flag $ for enabling purge logic for a line
Let's make the risk of accidental misuse, and mark lines that shall be covered by --purge with an explicit new flag "$". See: #33349
Diffstat (limited to '')
-rwxr-xr-xtest/units/TEST-22-TMPFILES.18.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/units/TEST-22-TMPFILES.18.sh b/test/units/TEST-22-TMPFILES.18.sh
index 5d24197c81..c81f6bd0ef 100755
--- a/test/units/TEST-22-TMPFILES.18.sh
+++ b/test/units/TEST-22-TMPFILES.18.sh
@@ -9,26 +9,39 @@ set -o pipefail
export SYSTEMD_LOG_LEVEL=debug
c='
-d /tmp/somedir
-f /tmp/somedir/somefile - - - - baz
+d$ /tmp/somedir
+f$ /tmp/somedir/somefile - - - - baz
+f /tmp/someotherfile - - - - qux
'
systemd-tmpfiles --create - <<<"$c"
test -f /tmp/somedir/somefile
grep -q baz /tmp/somedir/somefile
+grep -q qux /tmp/someotherfile
systemd-tmpfiles --purge --dry-run - <<<"$c"
test -f /tmp/somedir/somefile
grep -q baz /tmp/somedir/somefile
+grep -q qux /tmp/someotherfile
systemd-tmpfiles --purge - <<<"$c"
test ! -f /tmp/somedir/somefile
test ! -d /tmp/somedir/
+grep -q qux /tmp/someotherfile
systemd-tmpfiles --create --purge --dry-run - <<<"$c"
test ! -f /tmp/somedir/somefile
test ! -d /tmp/somedir/
+grep -q qux /tmp/someotherfile
systemd-tmpfiles --create --purge - <<<"$c"
test -f /tmp/somedir/somefile
grep -q baz /tmp/somedir/somefile
+grep -q qux /tmp/someotherfile
+
+systemd-tmpfiles --purge - <<<"$c"
+test ! -f /tmp/somedir/somefile
+test ! -d /tmp/somedir/
+grep -q qux /tmp/someotherfile
+
+rm /tmp/someotherfile