diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2020-06-09 16:51:55 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-06-10 17:42:25 +0200 |
commit | e47add9edceaf688634449a68f66a24c7b818b0e (patch) | |
tree | fa50d442993e940a9c7443a81bb982fbc1430b44 /test/units/testsuite-02.service | |
parent | core: don't consider SERVICE_SKIP_CONDITION for abnormal or failure restarts (diff) | |
download | systemd-e47add9edceaf688634449a68f66a24c7b818b0e.tar.xz systemd-e47add9edceaf688634449a68f66a24c7b818b0e.zip |
test: make TEST-02-CRYPTSETUP a bit more robust
Prompted by systemd/systemd#16111.
* check if /var is a mountpoint - if not, something went wrong. In case
of systemd/systemd#16111 the /failed file was created, because
systemd-cryptsetup failed, but it ended up being empty, making the result
check incorrectly pass
* forward journal messages to console - if we fail to mount /var,
journald won't flush logs to the persistent storage and we end up
empty handed and with no clue what went wrong
For example, without systemd/systemd#16111 and with this patch:
...
[FAILED] Failed to start systemd-cryptsetup@varcrypt.service.
See 'systemctl status systemd-cryptsetup@varcrypt.service' for details.
[DEPEND] Dependency failed for cryptsetup.target.
...
[ 3.882451] systemd-cryptsetup[581]: Key file /etc/varkey is world-readable. This is not a good idea!
[ 3.883946] systemd-cryptsetup[581]: WARNING: Locking directory /run/cryptsetup is missing!
[ 3.884846] systemd-cryptsetup[581]: Failed to load Bitlocker superblock on device /dev/disk/by-uuid/180ba5ef-873b-4018-9968-47c23431f71a: Invalid argument
...
[ 4.099451] sh[606]: + mountpoint /var
[ 4.100025] sh[603]: + systemctl poweroff --no-block
[ 4.101636] systemd[1]: Finished systemd-user-sessions.service.
[ 4.102598] sh[608]: /var is not a mountpoint
[FAILED] Failed to start testsuite-02.service.
Diffstat (limited to '')
-rw-r--r-- | test/units/testsuite-02.service | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/units/testsuite-02.service b/test/units/testsuite-02.service index 701610b790..13e7ec3639 100644 --- a/test/units/testsuite-02.service +++ b/test/units/testsuite-02.service @@ -4,5 +4,5 @@ After=multi-user.target [Service] ExecStartPre=rm -f /failed /testok -ExecStart=sh -x -c 'systemctl --state=failed --no-legend --no-pager >/failed ; echo OK > /testok' +ExecStart=sh -x -e -c 'mountpoint /var; systemctl --state=failed --no-legend --no-pager >/failed; echo OK >/testok' Type=oneshot |