mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
New test adds /bin/fail.sh to verify that a failing pre:script (that also takes too long to run) is detected: exit code and timeout. Ensure existing test pass full path to /sbin/fail.sh script. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
29 lines
594 B
Bash
Executable File
29 lines
594 B
Bash
Executable File
#!/bin/sh
|
|
# Verify Finit:
|
|
# - does not start main process when pre:script fails
|
|
# - times out and kills long running pre:script
|
|
set -eu
|
|
|
|
#export DEBUG=true
|
|
TEST_DIR=$(dirname "$0")
|
|
# shellcheck source=/dev/null
|
|
. "$TEST_DIR/lib/setup.sh"
|
|
|
|
vrfy()
|
|
{
|
|
nm=serv
|
|
tmo=$1
|
|
msg=$2
|
|
err=$3
|
|
|
|
run "echo 'service [2345] pre:$tmo,fail.sh $nm -n -- $msg' > $FINIT_CONF"
|
|
run "initctl reload"
|
|
|
|
retry "assert_status_full $nm 'crashed $err'" 50
|
|
}
|
|
|
|
#run "initctl debug"
|
|
|
|
vrfy 5 "Failing pre: script" "(code=exited, status=42)"
|
|
vrfy 1 "Timeout pre: script" "(code=signal, status=9/KILL)"
|