From c90feab4ff8bc23d88d4f9c67d9652ba189cb51b Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Fri, 25 Jan 2013 22:19:19 +0100 Subject: test: factor out testsuite.target, end.service Tests can use the same testsuite.target. Add end.service to call poweroff instead of doing it from ExecStopPost where it may be skipped on failure of ExecStart. --- test/TEST-01-BASIC/test.sh | 14 ++++---------- test/TEST-02-CRYPTSETUP/test.sh | 14 ++++---------- test/end.service | 6 ++++++ test/testsuite.target | 6 ++++++ 4 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 test/end.service create mode 100644 test/testsuite.target diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index 9ab0a6fce9..7d2e3d4bd7 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -123,15 +123,8 @@ EOF LABEL=systemd / ext3 rw 0 1 EOF - # setup the testsuite target - cat >$initdir/etc/systemd/system/testsuite.target <$initdir/etc/systemd/system/testsuite.service < /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;' -ExecStopPost=/usr/bin/systemctl poweroff --no-block Type=oneshot EOF + mkdir -p $initdir/etc/systemd/system/testsuite.target.wants ln -fs ../testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service + ln -fs ../end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service # make the testsuite the default target ln -fs testsuite.target $initdir/etc/systemd/system/default.target diff --git a/test/TEST-02-CRYPTSETUP/test.sh b/test/TEST-02-CRYPTSETUP/test.sh index a0e4d6580d..e0945313f8 100755 --- a/test/TEST-02-CRYPTSETUP/test.sh +++ b/test/TEST-02-CRYPTSETUP/test.sh @@ -122,15 +122,8 @@ LABEL=systemd / ext3 rw 0 1 /dev/mapper/varcrypt /var ext3 defaults 0 1 EOF - # setup the testsuite target - cat >$initdir/etc/systemd/system/testsuite.target <$initdir/etc/systemd/system/testsuite.service < /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;' -ExecStopPost=/usr/bin/systemctl poweroff --no-block Type=oneshot EOF + mkdir -p $initdir/etc/systemd/system/testsuite.target.wants ln -fs ../testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service + ln -fs ../end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service # make the testsuite the default target ln -fs testsuite.target $initdir/etc/systemd/system/default.target diff --git a/test/end.service b/test/end.service new file mode 100644 index 0000000000..0f04dfeb20 --- /dev/null +++ b/test/end.service @@ -0,0 +1,6 @@ +[Unit] +Description=End the test +After=testsuite.service + +[Service] +ExecStart=/usr/bin/systemctl poweroff --no-block diff --git a/test/testsuite.target b/test/testsuite.target new file mode 100644 index 0000000000..1a7e5b371a --- /dev/null +++ b/test/testsuite.target @@ -0,0 +1,6 @@ +[Unit] +Description=Testsuite target +Requires=multi-user.target +After=multi-user.target +Conflicts=rescue.target +AllowIsolate=yes -- cgit v1.2.3-54-g00ecf