tests: various fixes

* remove journal flushing (systemd-journal-flush.service runs journalctl --flush on boot)
* use sh -c and PATH instead of @SYSTEMCTL@ expansion
* remove unnecessary semicolons etc
This commit is contained in:
Evgeny Vereshchagin 2015-11-08 22:00:34 +00:00
parent 2933d599c2
commit 5c404f1ab8
6 changed files with 14 additions and 10 deletions

View File

@ -1506,7 +1506,7 @@ EXTRA_DIST += \
test/c.service \
test/daughter.service \
test/d.service \
test/end.service.in \
test/end.service \
test/e.service \
test/f.service \
test/grandchild.service \

View File

@ -53,7 +53,7 @@ Description=Testsuite service
After=multi-user.target
[Service]
ExecStart=/bin/bash -c 'set -x; systemctl --failed --no-legend --no-pager > /failed ; echo OK > /testok; while : ;do echo "testsuite service waiting for journal to move to /var/log/journal" > /dev/console ; for i in /var/log/journal/*;do [ -d "\$i" ] && echo "\$i" && break 2; done; sleep 1; done; sleep 1; exit 0;'
ExecStart=/bin/sh -x -c 'systemctl --failed --no-legend --no-pager > /failed ; echo OK > /testok'
Type=oneshot
EOF

View File

@ -59,7 +59,7 @@ Description=Testsuite service
After=multi-user.target
[Service]
ExecStart=/bin/bash -c 'set -x; systemctl --failed --no-legend --no-pager > /failed ; echo OK > /testok; while : ;do systemd-cat echo "testsuite service waiting for /var/log/journal" ; echo "testsuite service waiting for journal to move to /var/log/journal" > /dev/console ; for i in /var/log/journal/*;do [ -d "\$i" ] && echo "\$i" && break 2; done; sleep 1; done; sleep 1; exit 0;'
ExecStart=/bin/sh -x -c 'systemctl --failed --no-legend --no-pager > /failed ; echo OK > /testok'
Type=oneshot
EOF

10
test/end.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=End the test
After=testsuite.service
OnFailure=poweroff.target
OnFailureJobMode=replace-irreversibly
[Service]
Type=oneshot
ExecStart=/bin/sh -x -c 'systemctl poweroff --no-block'
TimeoutStartSec=5m

View File

@ -1,6 +0,0 @@
[Unit]
Description=End the test
After=testsuite.service
[Service]
ExecStart=@SYSTEMCTL@ poweroff --no-block

View File

@ -305,7 +305,7 @@ install_terminfo() {
setup_testsuite() {
cp $TEST_BASE_DIR/testsuite.target $initdir/etc/systemd/system/
sed "s#@SYSTEMCTL@#$(type -P systemctl)#g" $TEST_BASE_DIR/end.service.in > $initdir/etc/systemd/system/end.service
cp $TEST_BASE_DIR/end.service $initdir/etc/systemd/system/
mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
ln -fs $TEST_BASE_DIR/testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service