]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/units/testsuite-34.sh
tests: add spdx headers to scripts and Makefiles
[thirdparty/systemd.git] / test / units / testsuite-34.sh
CommitLineData
ff12a795 1#!/usr/bin/env bash
7b3cec95 2# SPDX-License-Identifier: LGPL-2.1-or-later
084575ff 3set -eux
528c3656
LP
4set -o pipefail
5
6systemd-analyze log-level debug
7systemd-analyze log-target console
8
9# Set everything up without DynamicUser=1
10
11systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz touch /var/lib/zzz/test
12systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test
4e20fe27
ZJS
13systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing \
14 && { echo 'unexpected success'; exit 1; }
528c3656
LP
15
16test -d /var/lib/zzz
ffa328f0
ZJS
17test ! -L /var/lib/zzz
18test ! -e /var/lib/private/zzz
528c3656 19test -f /var/lib/zzz/test
ffa328f0 20test ! -f /var/lib/zzz/test-missing
528c3656
LP
21
22# Convert to DynamicUser=1
23
24systemd-run --wait -p DynamicUser=1 -p StateDirectory=zzz test -f /var/lib/zzz/test
4e20fe27
ZJS
25systemd-run --wait -p DynamicUser=1 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing \
26 && { echo 'unexpected success'; exit 1; }
528c3656
LP
27
28test -L /var/lib/zzz
29test -d /var/lib/private/zzz
30
31test -f /var/lib/zzz/test
ffa328f0 32test ! -f /var/lib/zzz/test-missing
528c3656
LP
33
34# Convert back
35
36systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test
4e20fe27
ZJS
37systemd-run --wait -p DynamicUser=0 -p StateDirectory=zzz test -f /var/lib/zzz/test-missing \
38 && { echo 'unexpected success'; exit 1; }
528c3656
LP
39
40test -d /var/lib/zzz
ffa328f0
ZJS
41test ! -L /var/lib/zzz
42test ! -e /var/lib/private/zzz
528c3656 43test -f /var/lib/zzz/test
ffa328f0 44test ! -f /var/lib/zzz/test-missing
528c3656
LP
45
46systemd-analyze log-level info
47
0ee99483 48echo OK >/testok
528c3656
LP
49
50exit 0