mirror of
https://github.com/troglobit/finit.git
synced 2026-12-05 22:08:20 +00:00
test: add support for running a bootstrap config
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
7393072120
commit
74fc16b832
1 file changed
+14
-5
+14
-5
@@ -236,7 +236,7 @@ teardown()
|
|||||||
|
|
||||||
say "Final cleanup ..."
|
say "Final cleanup ..."
|
||||||
rm -f "$SYSROOT"/running_test.pid
|
rm -f "$SYSROOT"/running_test.pid
|
||||||
|
rm -f "$SYSROOT$FINIT_CONF"
|
||||||
|
|
||||||
say "EXIT: $test_status"
|
say "EXIT: $test_status"
|
||||||
exit $test_status
|
exit $test_status
|
||||||
@@ -262,6 +262,13 @@ else
|
|||||||
FINIT_RUNLEVEL=2
|
FINIT_RUNLEVEL=2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
set +u
|
||||||
|
if [ -n "$BOOTSTRAP" ]; then
|
||||||
|
say "Setting up bootstrap tasks ..."
|
||||||
|
echo "$BOOTSTRAP" > "$SYSROOT$FINIT_CONF"
|
||||||
|
fi
|
||||||
|
set -u
|
||||||
|
|
||||||
# shellcheck disable=2086
|
# shellcheck disable=2086
|
||||||
"$TEST_DIR/lib/start.sh" finit ${FINIT_ARGS:-} &
|
"$TEST_DIR/lib/start.sh" finit ${FINIT_ARGS:-} &
|
||||||
finit_ppid=$!
|
finit_ppid=$!
|
||||||
@@ -271,21 +278,23 @@ echo "$finit_ppid" > "$SYSROOT"/running_test.pid
|
|||||||
log "$color_reset" 'Setup of test environment done, waiting for Finit ...' ''
|
log "$color_reset" 'Setup of test environment done, waiting for Finit ...' ''
|
||||||
|
|
||||||
finit_pid=$(retry "pgrep -P $finit_ppid")
|
finit_pid=$(retry "pgrep -P $finit_ppid")
|
||||||
|
echo "Finit running as $finit_pid"
|
||||||
#tty=/dev/$(texec cat /sys/class/tty/console/active)
|
#tty=/dev/$(texec cat /sys/class/tty/console/active)
|
||||||
#texec cat "$tty" &
|
#texec cat "$tty" &
|
||||||
|
|
||||||
# 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
|
set +u
|
||||||
|
while [ -z "$BOOTSTRAP" ] && [ $i -lt 10 ]; do
|
||||||
lvl=$(texec sh -c "initctl runlevel | awk '{print \$2;}'")
|
lvl=$(texec sh -c "initctl runlevel | awk '{print \$2;}'")
|
||||||
if [ "$lvl" -eq "$FINIT_RUNLEVEL" ]; then
|
if [ "$lvl" = "$FINIT_RUNLEVEL" ]; then
|
||||||
# say "Reached runlevel $FINIT_RUNLEVEL, releasing test."
|
say "Reached runlevel $FINIT_RUNLEVEL, releasing test."
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
set -u
|
||||||
|
|
||||||
if type test_setup > /dev/null 2>&1 ; then
|
if type test_setup > /dev/null 2>&1 ; then
|
||||||
test_setup
|
test_setup
|
||||||
|
|||||||
Reference in new issue
Block a user