]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: correctly fail when system is borked
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 27 May 2019 17:59:26 +0000 (19:59 +0200)
committerEvgeny Vereshchagin <evvers@ya.ru>
Mon, 27 May 2019 19:31:55 +0000 (22:31 +0300)
In certain situations, the systemctl commands may fail (e.g. due to
missing shared libraries), but the 'script' continues and creates a
/testok file, marking the test incorrectly as passed. Let's fix this and
bail out immediately when a command exits with a non-zero exit code.

test/TEST-01-BASIC/test.sh

index 2314ec37ce5e1e91873c19688feac50a4821e1a8..0f29ad7eda727ddcdb3ecaf3a3e9c8d72f030d18 100755 (executable)
@@ -24,7 +24,7 @@ Description=Testsuite service
 After=multi-user.target
 
 [Service]
-ExecStart=/bin/sh -x -c 'systemctl --state=failed --no-legend --no-pager > /failed ; systemctl daemon-reload ; echo OK > /testok'
+ExecStart=/bin/sh -e -x -c 'systemctl --state=failed --no-legend --no-pager > /failed ; systemctl daemon-reload ; echo OK > /testok'
 Type=oneshot
 EOF