mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
db15657dfb
Let's make the risk of accidental misuse, and mark lines that shall be covered by --purge with an explicit new flag "$". See: #33349
48 lines
1.0 KiB
Bash
Executable File
48 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
#
|
|
# Tests for the --purge switch
|
|
#
|
|
set -eux
|
|
set -o pipefail
|
|
|
|
export SYSTEMD_LOG_LEVEL=debug
|
|
|
|
c='
|
|
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
|