]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/units/testsuite-46.sh
scope: on unified, make sure to unwatch all PIDs once they've been moved to the cgrou...
[thirdparty/systemd.git] / test / units / testsuite-46.sh
1 #!/usr/bin/env bash
2 set -ex
3 set -o pipefail
4
5 # Check if homectl is installed, and if it isn't bail out early instead of failing
6 if ! test -x /usr/bin/homectl ; then
7 echo OK > /testok
8 exit 0
9 fi
10
11 inspect() {
12 # As updating disk-size-related attributes can take some time on
13 # some filesystems, let's drop these fields before comparing the
14 # outputs to avoid unexpected fails. To see the full outputs of both
15 # homectl & userdbctl (for debugging purposes) drop the fields just
16 # before the comparison.
17 homectl inspect $1 | tee /tmp/a
18 userdbctl user $1 | tee /tmp/b
19
20 local PATTERN='/^\s*Disk (Size|Free|Floor|Ceiling):/d'
21 diff <(sed -r "$PATTERN" /tmp/a) <(sed -r "$PATTERN" /tmp/b)
22 rm /tmp/a /tmp/b
23 }
24
25 systemd-analyze log-level debug
26 systemd-analyze log-target console
27
28 NEWPASSWORD=xEhErW0ndafV4s homectl create test-user --disk-size=20M
29 inspect test-user
30
31 PASSWORD=xEhErW0ndafV4s homectl authenticate test-user
32
33 PASSWORD=xEhErW0ndafV4s homectl activate test-user
34 inspect test-user
35
36 PASSWORD=xEhErW0ndafV4s homectl update test-user --real-name="Inline test"
37 inspect test-user
38
39 homectl deactivate test-user
40 inspect test-user
41
42 PASSWORD=xEhErW0ndafV4s NEWPASSWORD=yPN4N0fYNKUkOq homectl passwd test-user
43 inspect test-user
44
45 PASSWORD=yPN4N0fYNKUkOq homectl activate test-user
46 inspect test-user
47
48 SYSTEMD_LOG_LEVEL=debug PASSWORD=yPN4N0fYNKUkOq NEWPASSWORD=xEhErW0ndafV4s homectl passwd test-user
49 inspect test-user
50
51 homectl deactivate test-user
52 inspect test-user
53
54 PASSWORD=xEhErW0ndafV4s homectl activate test-user
55 inspect test-user
56
57 PASSWORD=xEhErW0ndafV4s homectl deactivate test-user
58 inspect test-user
59
60 PASSWORD=xEhErW0ndafV4s homectl update test-user --real-name="Offline test"
61 inspect test-user
62
63 PASSWORD=xEhErW0ndafV4s homectl activate test-user
64 inspect test-user
65
66 PASSWORD=xEhErW0ndafV4s homectl deactivate test-user
67 inspect test-user
68
69 ! PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
70 PASSWORD=xEhErW0ndafV4s homectl with test-user -- touch /home/test-user/xyz
71 PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
72 PASSWORD=xEhErW0ndafV4s homectl with test-user -- rm /home/test-user/xyz
73 ! PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
74
75 homectl remove test-user
76
77 systemd-analyze log-level info
78
79 echo OK > /testok
80
81 exit 0