mirror of
https://github.com/troglobit/finit.git
synced 2026-11-02 13:20:32 +00:00
test: new test
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>
This commit is contained in:
5 files changed
+67
-25
No files matched your search
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/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)"
|
||||
Reference in new issue
Block a user