mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 14:02:52 +07:00
test: handle very short tests that exit before reaching runlevel 2
Bootstrap-only tests that just verify basic functionality are often very short. This change handles that by retrying SIGUSR2 until Finit has had the chance to finalize bootstrap and enable signals. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+10
-5
@@ -226,7 +226,8 @@ wdstart()
|
||||
|
||||
wdkill()
|
||||
{
|
||||
kill -KILL $wdpid
|
||||
say "Stopping test watchdog, pid $wdpid"
|
||||
kill -KILL $wdpid
|
||||
}
|
||||
|
||||
teardown()
|
||||
@@ -247,11 +248,15 @@ teardown()
|
||||
log "$fg_red" 'TEST FAIL' ''
|
||||
fi
|
||||
|
||||
say "Telling Finit to shut down (set -$-) ..."
|
||||
set +e
|
||||
if [ -n "${finit_pid+x}" ]; then
|
||||
texec kill -SIGUSR2 1
|
||||
fi
|
||||
say "Telling Finit to shut down (set -$-) ..."
|
||||
while [ -n "${finit_pid+x}" ]; do
|
||||
if ! kill -USR2 "${finit_pid}" 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
say "Retrying shutdown ..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
say "Waiting for Finit to shut down ..."
|
||||
wait
|
||||
|
||||
Reference in New Issue
Block a user