test: minor refactor, relocate "Test start ..." message to setup.sh

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2025-07-06 13:31:29 +02:00
1 parent d5a47e2d8b
commit ce7d4cebab
31 files changed
+21 -127

No files matched your search

@@ -15,8 +15,6 @@ test_teardown()
# shellcheck source=/dev/null # shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh" . "$TEST_DIR/lib/setup.sh"
say "Test start $(date)"
say "Add a dynamic service in $FINIT_RCSD/service.conf" say "Add a dynamic service in $FINIT_RCSD/service.conf"
run "echo 'service [2345] kill:20 log service.sh -- Dyn serv' > $FINIT_RCSD/service.conf" run "echo 'service [2345] kill:20 log service.sh -- Dyn serv' > $FINIT_RCSD/service.conf"
-2
View File
@@ -15,8 +15,6 @@ test_teardown()
# shellcheck source=/dev/null # shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh" . "$TEST_DIR/lib/setup.sh"
say "Test start $(date)"
say "Add a dynamic service in $FINIT_CONF" say "Add a dynamic service in $FINIT_CONF"
run "echo 'service [2345] kill:20 log service.sh -- Dyn service' > $FINIT_CONF" run "echo 'service [2345] kill:20 log service.sh -- Dyn service' > $FINIT_CONF"
-5
View File
@@ -11,11 +11,6 @@ BOOTSTRAP="run [S] crasher.sh -- Party crasher"
# shellcheck source=/dev/null # shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh" . "$TEST_DIR/lib/setup.sh"
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
-5
View File
@@ -7,11 +7,6 @@ set -eu
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
-5
View File
@@ -5,11 +5,6 @@ set -eu
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
-5
View File
@@ -14,11 +14,6 @@ set -eu
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
-5
View File
@@ -7,11 +7,6 @@ set -eu
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
-1
View File
@@ -8,7 +8,6 @@ TEST_DIR=$(dirname "$0")
test_setup() test_setup()
{ {
say "Test start $(date)"
run "mkdir -p /etc/default" run "mkdir -p /etc/default"
} }
-5
View File
@@ -8,11 +8,6 @@ set COLORTERM=yes\n\
b aq=oroszoe\n\ b aq=oroszoe\n\
baz=qux" baz=qux"
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
-5
View File
@@ -7,11 +7,6 @@ set -eu
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
+2
View File
@@ -362,6 +362,8 @@ echo "Finit running as PID $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" &
sep "Test start $(date)"
# Allow Finit to start up properly before launching the test # Allow Finit to start up properly before launching the test
i=0 i=0
set +u set +u
-1
View File
@@ -8,7 +8,6 @@ TEST_DIR=$(dirname "$0")
test_setup() test_setup()
{ {
say "Test start $(date)"
run "mkdir -p /etc/default" run "mkdir -p /etc/default"
} }
-5
View File
@@ -5,11 +5,6 @@ set -eu
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
-5
View File
@@ -9,11 +9,6 @@ set -eu
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
-1
View File
@@ -8,7 +8,6 @@ TEST_DIR=$(dirname "$0")
test_setup() test_setup()
{ {
say "Test start $(date)"
run "mkdir -p /etc/default" run "mkdir -p /etc/default"
} }
+5 -11
View File
@@ -1,26 +1,20 @@
#!/bin/sh #!/bin/sh
# Regression test for basic /etc/rc.local functionality # Regression test for basic /etc/rc.local functionality
# shellcheck disable=SC2317 # shellcheck disable=2317,2034
set -eu set -eu
RCLOCAL="echo 'KILROY WAS HERE' > /tmp/rclocal"
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
#DEBUG=1 #DEBUG=1
# shellcheck disable=SC2034
RCLOCAL="echo 'KILROY WAS HERE' > /tmp/rclocal"
# shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh"
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
} }
# shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh"
sleep 1 sleep 1
assert_file_contains /tmp/rclocal "KILROY WAS HERE" assert_file_contains /tmp/rclocal "KILROY WAS HERE"
-5
View File
@@ -4,11 +4,6 @@ set -eu
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
-1
View File
@@ -6,7 +6,6 @@ TEST_DIR=$(dirname "$0")
test_setup() test_setup()
{ {
say "Test start $(date)"
run "mkdir -p /etc/default" run "mkdir -p /etc/default"
} }
-1
View File
@@ -9,7 +9,6 @@ TEST_DIR=$(dirname "$0")
test_setup() test_setup()
{ {
say "Test start $(date)"
run "mkdir -p /etc/default" run "mkdir -p /etc/default"
export TEST_TIMEOUT=5 export TEST_TIMEOUT=5
} }
+3 -8
View File
@@ -21,19 +21,14 @@ run [4] name:four initctl restart service.sh -- Restart service"
# shellcheck disable=SC2034 # shellcheck disable=SC2034
RCLOCAL="echo \"$0 ==============\" &1>2" RCLOCAL="echo \"$0 ==============\" &1>2"
# shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh"
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
} }
# shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh"
say "$FINIT_CONF:" say "$FINIT_CONF:"
run "cat $FINIT_CONF" run "cat $FINIT_CONF"
say "/etc/rc.local:" say "/etc/rc.local:"
+1 -7
View File
@@ -1,17 +1,11 @@
#!/bin/sh #!/bin/sh
# Verify selecting alternate runlevel from cmdline # Verify selecting alternate runlevel from cmdline
# shellcheck disable=SC2034
set -eu set -eu
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
# shellcheck disable=SC2034
FINIT_RUNLEVEL=9 FINIT_RUNLEVEL=9
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
+5 -11
View File
@@ -8,26 +8,20 @@
# - SNNfoo should be called with a 'start' argument # - SNNfoo should be called with a 'start' argument
# - KNNfoo should be called with a 'stop' argument # - KNNfoo should be called with a 'stop' argument
# #
# shellcheck disable=SC2034
BOOTSTRAP="runparts /etc/rc.d"
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
#DEBUG=1 #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() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
} }
# shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh"
while true; do while true; do
lvl=$(texec initctl runlevel) lvl=$(texec initctl runlevel)
say "Current runlevel $lvl" say "Current runlevel $lvl"
-2
View File
@@ -16,8 +16,6 @@ test_teardown()
# shellcheck source=/dev/null # shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh" . "$TEST_DIR/lib/setup.sh"
say "Test start $(date)"
say 'Ensure file system is cleared' say 'Ensure file system is cleared'
run "rm -f /tmp/usr1.log" run "rm -f /tmp/usr1.log"
-1
View File
@@ -17,7 +17,6 @@ test_teardown()
# shellcheck source=/dev/null # shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh" . "$TEST_DIR/lib/setup.sh"
say "Test start $(date)"
rm -f "$SYSROOT"/oldpid rm -f "$SYSROOT"/oldpid
say "Add service stanza in $FINIT_CONF" say "Add service stanza in $FINIT_CONF"
-1
View File
@@ -24,7 +24,6 @@ test_teardown()
say "Check deps ..." say "Check deps ..."
check_dep jq check_dep jq
say "Test start $(date)"
rm -f "$SYSROOT"/oldpid rm -f "$SYSROOT"/oldpid
say "Add service stanza in $FINIT_CONF" say "Add service stanza in $FINIT_CONF"
-5
View File
@@ -3,11 +3,6 @@ set -eu
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
-2
View File
@@ -15,8 +15,6 @@ test_teardown()
# shellcheck source=/dev/null # shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh" . "$TEST_DIR/lib/setup.sh"
say "Test start $(date)"
say "Add service stanza in $FINIT_RCSD/service.conf" say "Add service stanza in $FINIT_RCSD/service.conf"
run "echo 'service [2345] kill:20 log service.sh -- Subserv' > $FINIT_RCSD/service.conf" run "echo 'service [2345] kill:20 log service.sh -- Subserv' > $FINIT_RCSD/service.conf"
-2
View File
@@ -15,8 +15,6 @@ test_teardown()
# shellcheck source=/dev/null # shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh" . "$TEST_DIR/lib/setup.sh"
say "Test start $(date)"
say "Add service stanza in $FINIT_CONF" say "Add service stanza in $FINIT_CONF"
run "echo 'service [2345] kill:20 log service.sh -- Test service' > $FINIT_CONF" run "echo 'service [2345] kill:20 log service.sh -- Test service' > $FINIT_CONF"
-5
View File
@@ -4,11 +4,6 @@ set -e
TEST_DIR=$(dirname "$0") TEST_DIR=$(dirname "$0")
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
+5 -12
View File
@@ -8,27 +8,20 @@
# - SNNfoo should be called with a 'start' argument # - SNNfoo should be called with a 'start' argument
# - KNNfoo should be called with a 'stop' argument # - KNNfoo should be called with a 'stop' argument
# #
TEST_DIR=$(dirname "$0")
# shellcheck disable=2034 # shellcheck disable=2034
DEBUG=1
# shellcheck disable=SC2034
BOOTSTRAP="runparts sysv /etc/rcS.d" BOOTSTRAP="runparts sysv /etc/rcS.d"
TEST_DIR=$(dirname "$0")
# shellcheck source=/dev/null DEBUG=1
. "$TEST_DIR/lib/setup.sh"
test_setup()
{
say "Test start $(date)"
}
test_teardown() test_teardown()
{ {
say "Test done $(date)" say "Test done $(date)"
} }
# shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh"
while true; do while true; do
lvl=$(texec initctl runlevel) lvl=$(texec initctl runlevel)
say "Current runlevel $lvl" say "Current runlevel $lvl"
-1
View File
@@ -20,7 +20,6 @@ service log:stdout notify:s6 <service/B/ready> name:C serv -np -i C -N %n
service log:stdout notify:none <pid/A> name:D type:forking serv -i D -- D needs A (forking) service log:stdout notify:none <pid/A> name:D type:forking serv -i D -- D needs A (forking)
task <service/C/ready,service/D/ready> name:allup initctl cond set allup -- Everything is up task <service/C/ready,service/D/ready> name:allup initctl cond set allup -- Everything is up
EOF EOF
say "Test start $(date)"
} }
test_teardown() test_teardown()