mirror of
https://github.com/troglobit/finit.git
synced 2026-11-27 20:48:24 +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
|
if [ -n "${DEBUG:-}" ]; then
|
||||||
FINIT_ARGS="${FINIT_ARGS:-} finit.debug=on"
|
FINIT_ARGS="${FINIT_ARGS:-} finit.debug=on"
|
||||||
fi
|
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
|
# shellcheck disable=2086
|
||||||
"$TEST_DIR/tenv/start.sh" finit ${FINIT_ARGS:-} &
|
"$TEST_DIR/tenv/start.sh" finit ${FINIT_ARGS:-} &
|
||||||
finit_ppid=$!
|
finit_ppid=$!
|
||||||
@@ -179,14 +187,11 @@ finit_pid=$(retry "pgrep -P $finit_ppid")
|
|||||||
# Allow Finit to start up properly before launching the test
|
# Allow Finit to start up properly before launching the test
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt 10 ]; do
|
while [ $i -lt 10 ]; do
|
||||||
echo "Checking runlevel ..."
|
|
||||||
lvl=$(texec sh -c "initctl runlevel | awk '{print \$2;}'")
|
lvl=$(texec sh -c "initctl runlevel | awk '{print \$2;}'")
|
||||||
echo "Runlevel is $lvl"
|
if [ "$lvl" -eq "$FINIT_RUNLEVEL" ]; then
|
||||||
if [ $lvl -eq 2 ]; then
|
# say "Reached runlevel $FINIT_RUNLEVEL, releasing test."
|
||||||
say 'Reached runlevel 2, releasing test.'
|
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
echo "Waiting for Finit ..."
|
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in new issue
Block a user