Files
finit/test/runparts.sh
T
Joachim Wiberg 304a096877 test: wait for runparts to finish
In Finit v4.5 we've moved the start of rc.local and runparts to the
transtion from bootstrap to multi-user, so we must give it time to
finish.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-10-30 18:16:24 +01:00

43 lines
896 B
Bash
Executable File

#!/bin/sh
#
# Verifies basic runparts behavior: to run all scripts in a directory at
# the end of system bootstrap, right before calling /etc/rc.local:
#
# - only executable scripts should be called
# - always in alphabetical order
# - SNNfoo should be called with a 'start' argument
# - KNNfoo should be called with a 'stop' argument
#
TEST_DIR=$(dirname "$0")
#DEBUG=1
# shellcheck disable=SC2034
BOOTSTRAP="runparts /etc/rc.d"
# shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh"
test_setup()
{
say "Test start $(date)"
}
test_teardown()
{
say "Test done $(date)"
}
while true; do
lvl=$(texec initctl runlevel)
say "Current runlevel $lvl"
if [ "$lvl" = "N 2" ]; then
break;
fi
sleep 1
done
sleep 1
texec diff -u /usr/share/runparts/ref.log /tmp/runparts.log
texec cmp /usr/share/runparts/ref.log /tmp/runparts.log || fail "runparts in wrong order"