mirror of
https://github.com/troglobit/finit.git
synced 2026-10-17 10:49:34 +00:00
test: add support for overriding default runlevel
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
0cce69892a
commit
73423699fd
1 file changed
+10
-5
+10
-5
@@ -163,6 +163,14 @@ export TENV_ROOT
|
||||
if [ -n "${DEBUG:-}" ]; then
|
||||
FINIT_ARGS="${FINIT_ARGS:-} finit.debug=on"
|
||||
fi
|
||||
|
||||
# Tests may want to override runlevel
|
||||
if [ -n "${FINIT_RUNLEVEL:-}" ]; then
|
||||
FINIT_ARGS="${FINIT_ARGS:-} $FINIT_RUNLEVEL"
|
||||
else
|
||||
FINIT_RUNLEVEL=2
|
||||
fi
|
||||
|
||||
# shellcheck disable=2086
|
||||
"$TEST_DIR/tenv/start.sh" finit ${FINIT_ARGS:-} &
|
||||
finit_ppid=$!
|
||||
@@ -179,14 +187,11 @@ finit_pid=$(retry "pgrep -P $finit_ppid")
|
||||
# Allow Finit to start up properly before launching the test
|
||||
i=0
|
||||
while [ $i -lt 10 ]; do
|
||||
echo "Checking runlevel ..."
|
||||
lvl=$(texec sh -c "initctl runlevel | awk '{print \$2;}'")
|
||||
echo "Runlevel is $lvl"
|
||||
if [ $lvl -eq 2 ]; then
|
||||
say 'Reached runlevel 2, releasing test.'
|
||||
if [ "$lvl" -eq "$FINIT_RUNLEVEL" ]; then
|
||||
# say "Reached runlevel $FINIT_RUNLEVEL, releasing test."
|
||||
break;
|
||||
fi
|
||||
echo "Waiting for Finit ..."
|
||||
i=$((i + 1))
|
||||
sleep 1
|
||||
done
|
||||
|
||||
Reference in new issue
Block a user