diff --git a/test/add-remove-dynamic-service-sub-config.sh b/test/add-remove-dynamic-service-sub-config.sh index e35ceb39..a0e3a709 100755 --- a/test/add-remove-dynamic-service-sub-config.sh +++ b/test/add-remove-dynamic-service-sub-config.sh @@ -6,10 +6,10 @@ TEST_DIR=$(dirname "$0") test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_RCSD/service.conf" + say "Running test teardown." + run "rm -f $FINIT_RCSD/service.conf" } # shellcheck source=/dev/null diff --git a/test/add-remove-dynamic-service.sh b/test/add-remove-dynamic-service.sh index 29c49296..df6cb029 100755 --- a/test/add-remove-dynamic-service.sh +++ b/test/add-remove-dynamic-service.sh @@ -6,10 +6,10 @@ TEST_DIR=$(dirname "$0") test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } # shellcheck source=/dev/null diff --git a/test/cond-start-task.sh b/test/cond-start-task.sh index 0aa6e68f..2678d3a3 100755 --- a/test/cond-start-task.sh +++ b/test/cond-start-task.sh @@ -9,77 +9,77 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" - say "Running test teardown." - run "rm -f $TEST_CONF" + say "Test done $(date)" + say "Running test teardown." + run "rm -f $TEST_CONF" } test_one() { - cond=$1 - stanza=$2 + cond=$1 + stanza=$2 - sleep 5 - say 'Enable finit debug, try to figure out what is going on ...' - run "initctl debug" + sleep 5 + say 'Enable finit debug, try to figure out what is going on ...' + run "initctl debug" - say "Add stanza '$stanza' to $TEST_CONF ..." - run "echo '$stanza' > $TEST_CONF" + say "Add stanza '$stanza' to $TEST_CONF ..." + run "echo '$stanza' > $TEST_CONF" - run "ls -l /run/ /run/finit/" - say 'Reload Finit' - run "initctl ls" - run "initctl reload" - run "initctl status" - run "ps" + run "ls -l /run/ /run/finit/" + say 'Reload Finit' + run "initctl ls" + run "initctl reload" + run "initctl status" + run "ps" - date - sleep 2 - date - run "ls -l /run/ /run/finit/" - say 'Asserting condition' - run "initctl cond set $cond" + date + sleep 2 + date + run "ls -l /run/ /run/finit/" + say 'Asserting condition' + run "initctl cond set $cond" - date - sleep 2 - date - run "ls -l /run/ /run/finit/" - run "initctl status" - run "ps" - run "initctl status task.sh" + date + sleep 2 + date + run "ls -l /run/ /run/finit/" + run "initctl status" + run "ps" + run "initctl status task.sh" - sleep 1 - run "echo Hej; cat /run/task.state" + sleep 1 + run "echo Hej; cat /run/task.state" - assert_file_contains /run/task.state 1 + assert_file_contains /run/task.state 1 - say 'Reload Finit' - run "initctl reload" - sleep 1 - say 'Ensure task has not run again ...' - assert_file_contains /run/task.state 1 + say 'Reload Finit' + run "initctl reload" + sleep 1 + say 'Ensure task has not run again ...' + assert_file_contains /run/task.state 1 - say 'Switch to another runlevel ...' - run "initctl runlevel 3" - sleep 1 - say 'Ensure task has run again ...' - assert_file_contains /run/task.state 2 - - say 'Touch task.sh .conf file and reload Finit ...' - run "touch $TEST_CONF" - run "initctl reload" - sleep 1 -# run "initctl status task.sh" - assert_file_contains /run/task.state 3 + say 'Switch to another runlevel ...' + run "initctl runlevel 3" + sleep 1 + say 'Ensure task has run again ...' + assert_file_contains /run/task.state 2 + + say 'Touch task.sh .conf file and reload Finit ...' + run "touch $TEST_CONF" + run "initctl reload" + sleep 1 + # run "initctl status task.sh" + assert_file_contains /run/task.state 3 - say "Done, drop stanza from $TEST_CONF ..." - run "rm $TEST_CONF" - run "initctl reload" + say "Done, drop stanza from $TEST_CONF ..." + run "rm $TEST_CONF" + run "initctl reload" } diff --git a/test/crashing.sh b/test/crashing.sh index c54fc813..7f154583 100755 --- a/test/crashing.sh +++ b/test/crashing.sh @@ -7,57 +7,57 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" "/tmp/post" + say "Running test teardown." + run "rm -f $FINIT_CONF" "/tmp/post" } crashit() { - nm=$1 + nm=$1 - say 'Simulate service crash (kill -9 ..)' - i=0 - laps=100 - while [ $i -lt $laps ]; do - i=$((i + 1)) - say "Lap $i/$laps, killing service $nm ..." # we have this, no sleep needed - if ! run "slay $nm"; then - break; - fi - done + say 'Simulate service crash (kill -9 ..)' + i=0 + laps=100 + while [ $i -lt $laps ]; do + i=$((i + 1)) + say "Lap $i/$laps, killing service $nm ..." # we have this, no sleep needed + if ! run "slay $nm"; then + break; + fi + done } test_one() { - type=$1 - shift - nm=$1 - shift - args=$* + type=$1 + shift + nm=$1 + shift + args=$* - say "Add service stanza in $FINIT_CONF" - run "echo service log:stderr oncrash:script post:/bin/post.sh $nm $args > $FINIT_CONF" + say "Add service stanza in $FINIT_CONF" + run "echo service log:stderr oncrash:script post:/bin/post.sh $nm $args > $FINIT_CONF" - say 'Reload Finit' - run "initctl reload" + say 'Reload Finit' + run "initctl reload" - if [ "$type" = "sig" ]; then - retry "assert_num_children 1 $nm" - run "initctl status $nm" - crashit "$nm" - fi + if [ "$type" = "sig" ]; then + retry "assert_num_children 1 $nm" + run "initctl status $nm" + crashit "$nm" + fi - retry "assert_status $nm crashed" 500 - run "cat /tmp/post" - assert_file_contains "/tmp/post" "POST" - run "rm -f /tmp/post" + retry "assert_status $nm crashed" 500 + run "cat /tmp/post" + assert_file_contains "/tmp/post" "POST" + run "rm -f /tmp/post" } # shellcheck source=/dev/null diff --git a/test/depserv.sh b/test/depserv.sh index b227e317..7c3ee728 100755 --- a/test/depserv.sh +++ b/test/depserv.sh @@ -16,15 +16,15 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" - say "Running test teardown." + say "Test done $(date)" + say "Running test teardown." - run "rm -f $FINIT_CONF" "/tmp/post" + run "rm -f $FINIT_CONF" "/tmp/post" } # shellcheck source=/dev/null @@ -35,36 +35,36 @@ test_teardown() test_one() { - cond=$1 - say "Verifying foo -> <$cond> bar ..." - run "echo service log:stderr name:foo serv -np -i foo -f /tmp/arrakis > $FINIT_CONF" - run "echo service log:stderr name:bar \ serv -np -i bar -F /tmp/arrakis >> $FINIT_CONF" - run "cat $FINIT_CONF" + cond=$1 + say "Verifying foo -> <$cond> bar ..." + run "echo service log:stderr name:foo serv -np -i foo -f /tmp/arrakis > $FINIT_CONF" + run "echo service log:stderr name:bar \ serv -np -i bar -F /tmp/arrakis >> $FINIT_CONF" + run "cat $FINIT_CONF" - say 'Reload Finit' - run "initctl reload" + say 'Reload Finit' + run "initctl reload" - run "initctl status" - assert_status "foo" "running" - assert_cond "$cond" - assert_status "bar" "running" + run "initctl status" + assert_status "foo" "running" + assert_cond "$cond" + assert_status "bar" "running" - say "Verify bar is restarted when foo is ..." - pid=$(texec initctl |grep bar | awk '{print $1;}') - run "initctl restart foo" - run "initctl status" - assert "bar is restarted" "$(texec initctl |grep bar | awk '{print $1;}')" != "$pid" + say "Verify bar is restarted when foo is ..." + pid=$(texec initctl |grep bar | awk '{print $1;}') + run "initctl restart foo" + run "initctl status" + assert "bar is restarted" "$(texec initctl |grep bar | awk '{print $1;}')" != "$pid" - # Wait for spice to be stolen by the Harkonnen - sleep 3 - # bar should now have detected the loss of spice and be in restart - run "initctl status" - assert_status "bar" "restart" - # verify bar is stopped->waiting and no longer in restart after stopping foo - run "initctl stop foo" - run "initctl status" - run "initctl status bar" - assert_status "bar" "waiting" + # Wait for spice to be stolen by the Harkonnen + sleep 3 + # bar should now have detected the loss of spice and be in restart + run "initctl status" + assert_status "bar" "restart" + # verify bar is stopped->waiting and no longer in restart after stopping foo + run "initctl stop foo" + run "initctl status" + run "initctl status bar" + assert_status "bar" "waiting" } sep diff --git a/test/devmon.sh b/test/devmon.sh index 08aa9586..edd6e142 100755 --- a/test/devmon.sh +++ b/test/devmon.sh @@ -9,52 +9,52 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" - say "Running test teardown." + say "Test done $(date)" + say "Running test teardown." - run "rm -f $FINIT_CONF /tmp/post" + run "rm -f $FINIT_CONF /tmp/post" } # Cannot run mknod as non-root even in a chroot # touch is close enough for our needs mkdev() { - dir=$(dirname "$1") - run "mkdir -p $dir" - run "touch $1" + dir=$(dirname "$1") + run "mkdir -p $dir" + run "touch $1" } rmdev() { - run "rm $1" + run "rm $1" } test_one() { - cond="$1" - node="/$cond" + cond="$1" + node="/$cond" - say "Checking cond $cond and device $node ..." - run "echo service log:null \<$cond\> serv -np >> $FINIT_CONF" - run "cat $FINIT_CONF" - run "initctl reload" + say "Checking cond $cond and device $node ..." + run "echo service log:null \<$cond\> serv -np >> $FINIT_CONF" + run "cat $FINIT_CONF" + run "initctl reload" - assert_status "serv" "waiting" + assert_status "serv" "waiting" - mkdev "$node" - assert_status "serv" "running" + mkdev "$node" + assert_status "serv" "running" - rmdev "$node" - assert_status "serv" "waiting" + rmdev "$node" + assert_status "serv" "waiting" - say "Cleaning up ..." - run "rm $FINIT_CONF" - run "initctl reload" + say "Cleaning up ..." + run "rm $FINIT_CONF" + run "initctl reload" } # shellcheck source=/dev/null diff --git a/test/failing-sysv.sh b/test/failing-sysv.sh index 4ca8e2dd..377cf03a 100755 --- a/test/failing-sysv.sh +++ b/test/failing-sysv.sh @@ -8,16 +8,16 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" - run "mkdir -p /etc/default" + say "Test start $(date)" + run "mkdir -p /etc/default" } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } # shellcheck source=/dev/null diff --git a/test/global-envs.sh b/test/global-envs.sh index aac3f209..0528ca14 100755 --- a/test/global-envs.sh +++ b/test/global-envs.sh @@ -5,15 +5,15 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } # shellcheck source=/dev/null diff --git a/test/initctl-status-subset.sh b/test/initctl-status-subset.sh index cd8a0c36..863acb05 100755 --- a/test/initctl-status-subset.sh +++ b/test/initctl-status-subset.sh @@ -9,28 +9,28 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } test_init() { - run "echo '# Three foo and one bar enter Finit' > $FINIT_CONF" + run "echo '# Three foo and one bar enter Finit' > $FINIT_CONF" } test_add_one() { - service=$1 + service=$1 - say "Add service stanza '$service' to $FINIT_CONF ..." - run "echo '$service' >> $FINIT_CONF" + say "Add service stanza '$service' to $FINIT_CONF ..." + run "echo '$service' >> $FINIT_CONF" } # shellcheck source=/dev/null diff --git a/test/lib/enter.sh b/test/lib/enter.sh index 1f198021..a5750448 100755 --- a/test/lib/enter.sh +++ b/test/lib/enter.sh @@ -4,10 +4,10 @@ set -eu cmd="" if [ "$#" -lt 1 ]; then - cmd="/bin/sh" + cmd="/bin/sh" else - cmd=$1 - shift + cmd=$1 + shift fi TEST_DIR=$(dirname "$0")/.. @@ -15,11 +15,11 @@ SYSROOT="${SYSROOT:-$(pwd)/${TEST_DIR}/sysroot}" PID_FILE="$SYSROOT/running_test.pid" if [ -f "$PID_FILE" ] ; then - target=$(cat "$PID_FILE") - target=$(pgrep -P "$target") + target=$(cat "$PID_FILE") + target=$(pgrep -P "$target") else - echo "No test running!" - exit 1 + echo "No test running!" + exit 1 fi # shellcheck disable=SC1091 diff --git a/test/lib/exec.sh b/test/lib/exec.sh index 15ddde70..6efadc91 100755 --- a/test/lib/exec.sh +++ b/test/lib/exec.sh @@ -24,9 +24,9 @@ set -eu if [ "$#" -lt 2 ]; then - echo "Usage:" - echo " $0 [target-pid] [command [arguments]]" - exit 1 + echo "Usage:" + echo " $0 [target-pid] [command [arguments]]" + exit 1 fi target="$1" shift @@ -46,12 +46,12 @@ PATH="$TESTENV_PATH" export PATH "$nsenter" \ - --preserve-credentials \ - --user \ - --mount \ - --uts \ - --ipc \ - --net \ - --pid \ - -w -t "$target" \ - "$chroot" "$SYSROOT" "$@" + --preserve-credentials \ + --user \ + --mount \ + --uts \ + --ipc \ + --net \ + --pid \ + -w -t "$target" \ + "$chroot" "$SYSROOT" "$@" diff --git a/test/lib/setup.sh b/test/lib/setup.sh index 61a3932b..f5a521ad 100755 --- a/test/lib/setup.sh +++ b/test/lib/setup.sh @@ -342,17 +342,17 @@ echo "Finit running as PID $finit_pid" i=0 set +u while [ -z "$BOOTSTRAP" ] && [ $i -lt 10 ]; do - lvl=$(texec sh -c "initctl runlevel | awk '{print \$2;}'") - if [ "$lvl" = "$FINIT_RUNLEVEL" ]; then - say "Reached runlevel $FINIT_RUNLEVEL, releasing test." - break; - fi - i=$((i + 1)) - sleep 1 + lvl=$(texec sh -c "initctl runlevel | awk '{print \$2;}'") + if [ "$lvl" = "$FINIT_RUNLEVEL" ]; then + say "Reached runlevel $FINIT_RUNLEVEL, releasing test." + break; + fi + i=$((i + 1)) + sleep 1 done set -u if type test_setup > /dev/null 2>&1 ; then - test_setup + test_setup fi wdstart $TEST_TIMEOUT diff --git a/test/notify.sh b/test/notify.sh index c68e8327..41c86841 100755 --- a/test/notify.sh +++ b/test/notify.sh @@ -8,16 +8,16 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" - run "mkdir -p /etc/default" + say "Test start $(date)" + run "mkdir -p /etc/default" } test_teardown() { - say "Test done $(date)" - say "Running test teardown." + say "Test done $(date)" + say "Running test teardown." - run "rm -f $FINIT_CONF" + run "rm -f $FINIT_CONF" } test_one() @@ -37,11 +37,11 @@ test_one() run "initctl reload" sleep 1 -# run "initctl status serv" + # run "initctl status serv" assert_status "serv" "running" sleep 2 -# run "initctl cond dump" + # run "initctl cond dump" assert_cond "service/serv/ready" say "Verify 'ready' is set after SIGHUP ..." @@ -52,7 +52,7 @@ test_one() # Issue #343 say "Verify 'ready' is reasserted if service crashes and is restarted ..." -# run "initctl status serv" + # run "initctl status serv" run "initctl signal serv 9" retry 'assert_status "serv" "running"' 2 1 retry 'assert_cond "service/serv/ready"' 3 1 @@ -67,7 +67,7 @@ test_one() say "Verify 'ready' is reasserted on 'initctl reload' ..." run "initctl reload" sleep 1 -# run "initctl; initctl cond dump" + # run "initctl; initctl cond dump" assert_status "serv" "running" assert_cond "service/serv/ready" @@ -75,12 +75,12 @@ test_one() # 'started' when they created their PID file. The serv test daemon # waits 3 sec between pidfile and notify to trigger this bug. if [ "$type" != "native" ]; then - say "Verify 'ready' is *not* asserted immediately on restart + reload" - run "initctl restart serv" - run "initctl reload" - sleep 1 - assert_nocond "service/serv/ready" - retry 'assert_cond "service/serv/ready"' 5 0.5 + say "Verify 'ready' is *not* asserted immediately on restart + reload" + run "initctl restart serv" + run "initctl reload" + sleep 1 + assert_nocond "service/serv/ready" + retry 'assert_cond "service/serv/ready"' 5 0.5 fi say "Verify 'ready' is deasserted on stop ..." @@ -93,9 +93,9 @@ test_one() run "rm -f $FINIT_CONF" run "initctl reload" - # sleep 2 - # num=$(run "find /proc/1/fd |wc -l") - # say "finit: number of open file descriptors after test: $num" +# sleep 2 +# num=$(run "find /proc/1/fd |wc -l") +# say "finit: number of open file descriptors after test: $num" } # shellcheck source=/dev/null diff --git a/test/pidfile.sh b/test/pidfile.sh index 9706b6f8..737fc31f 100755 --- a/test/pidfile.sh +++ b/test/pidfile.sh @@ -7,32 +7,32 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" - say "Running test teardown." + say "Test done $(date)" + say "Running test teardown." - run "rm -f $FINIT_CONF" "/tmp/post" + run "rm -f $FINIT_CONF" "/tmp/post" } test_one() { - pidfn=$1 - service=$2 + pidfn=$1 + service=$2 - sep - say "Add service stanza '$service' to $FINIT_CONF ..." - run "echo '$service' > $FINIT_CONF" - run "initctl reload" + sep + say "Add service stanza '$service' to $FINIT_CONF ..." + run "echo '$service' > $FINIT_CONF" + run "initctl reload" - assert_is_pidfile "serv" "$pidfn" + assert_is_pidfile "serv" "$pidfn" - say "Done, drop service from $FINIT_CONF ..." - run "rm $FINIT_CONF" - run "initctl reload" + say "Done, drop service from $FINIT_CONF ..." + run "rm $FINIT_CONF" + run "initctl reload" } # shellcheck source=/dev/null diff --git a/test/pre-post-serv.sh b/test/pre-post-serv.sh index 9e3189fd..cc90864a 100755 --- a/test/pre-post-serv.sh +++ b/test/pre-post-serv.sh @@ -5,49 +5,49 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } test_one() { - pre=$1 - precont=$2 - service=$3 - post=$4 - postcont=$5 + pre=$1 + precont=$2 + service=$3 + post=$4 + postcont=$5 - say "Add service stanza '$service' to $FINIT_CONF ..." - run "echo '$service' > $FINIT_CONF" + say "Add service stanza '$service' to $FINIT_CONF ..." + run "echo '$service' > $FINIT_CONF" - say 'Reload Finit' - run "initctl reload" + say 'Reload Finit' + run "initctl reload" - retry 'assert_num_children 1 serv' - if [ -n "$pre" ]; then - assert_file_contains "$pre" "$precont" - run "rm -f $pre" - fi + retry 'assert_num_children 1 serv' + if [ -n "$pre" ]; then + assert_file_contains "$pre" "$precont" + run "rm -f $pre" + fi - say 'Stop the service' - run "initctl stop serv" + say 'Stop the service' + run "initctl stop serv" - retry 'assert_num_children 0 serv' - if [ -n "$post" ]; then - assert_file_contains "$post" "$postcont" - run "rm -f $post" - fi + retry 'assert_num_children 0 serv' + if [ -n "$post" ]; then + assert_file_contains "$post" "$postcont" + run "rm -f $post" + fi - say "Done, drop service from $FINIT_CONF ..." - run "rm $FINIT_CONF" - run "initctl reload" + say "Done, drop service from $FINIT_CONF ..." + run "rm $FINIT_CONF" + run "initctl reload" } # shellcheck source=/dev/null diff --git a/test/rclocal.sh b/test/rclocal.sh index eecd386d..c60d0ce2 100755 --- a/test/rclocal.sh +++ b/test/rclocal.sh @@ -12,12 +12,12 @@ RCLOCAL="echo 'KILROY WAS HERE' > /tmp/rclocal" test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" } sleep 1 diff --git a/test/ready-serv.sh b/test/ready-serv.sh index 7ea29aa8..aa624249 100755 --- a/test/ready-serv.sh +++ b/test/ready-serv.sh @@ -6,39 +6,39 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } test_one() { - service=$1 - file=/tmp/ready + service=$1 + file=/tmp/ready - say "Add service stanza '$service' to $FINIT_CONF ..." - run "echo '$service' > $FINIT_CONF" + say "Add service stanza '$service' to $FINIT_CONF ..." + run "echo '$service' > $FINIT_CONF" - say 'Reload Finit' - run "initctl reload" + say 'Reload Finit' + run "initctl reload" - retry 'assert_num_children 1 serv' - assert_file_contains "$file" "READY" - run "rm -f $file" + retry 'assert_num_children 1 serv' + assert_file_contains "$file" "READY" + run "rm -f $file" - say 'Stop the service' - run "initctl stop serv" - retry 'assert_num_children 0 serv' + say 'Stop the service' + run "initctl stop serv" + retry 'assert_num_children 0 serv' - say "Done, drop service from $FINIT_CONF ..." - run "rm $FINIT_CONF" - run "initctl reload" + say "Done, drop service from $FINIT_CONF ..." + run "rm $FINIT_CONF" + run "initctl reload" } # shellcheck source=/dev/null diff --git a/test/restart-self.sh b/test/restart-self.sh index 751ddb9c..633d9a7f 100755 --- a/test/restart-self.sh +++ b/test/restart-self.sh @@ -6,21 +6,21 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" - run "mkdir -p /etc/default" + say "Test start $(date)" + run "mkdir -p /etc/default" } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } check_restarts() { - assert "serv restarts" "$(texec cat "$1" | awk '{print $1;}')" -ge "$2" + assert "serv restarts" "$(texec cat "$1" | awk '{print $1;}')" -ge "$2" } diff --git a/test/run-restart-forever.sh b/test/run-restart-forever.sh index a4cd04b3..5df28a10 100755 --- a/test/run-restart-forever.sh +++ b/test/run-restart-forever.sh @@ -9,17 +9,17 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" - run "mkdir -p /etc/default" - export TEST_TIMEOUT=5 + say "Test start $(date)" + run "mkdir -p /etc/default" + export TEST_TIMEOUT=5 } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } # shellcheck source=/dev/null diff --git a/test/runlevel.sh b/test/runlevel.sh index d5fb101a..4b3e33c9 100755 --- a/test/runlevel.sh +++ b/test/runlevel.sh @@ -9,12 +9,12 @@ FINIT_RUNLEVEL=9 test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" } # shellcheck source=/dev/null @@ -23,7 +23,7 @@ test_teardown() say 'Check runlevel' lvl=$(run "initctl runlevel | awk '{print \$2;}'") if [ "$lvl" -eq "9" ]; then - return 0 + return 0 fi return 1 diff --git a/test/setup-sysroot.sh b/test/setup-sysroot.sh index 77e598c7..1ead6341 100755 --- a/test/setup-sysroot.sh +++ b/test/setup-sysroot.sh @@ -13,11 +13,11 @@ FINITBIN="$(pwd)/$top_builddir/src/finit" DEST="$SYSROOT" make -f "$srcdir/lib/s # Drop plugins we don't need in test, only causes confusing FAIL in logs. for plugin in tty.so urandom.so rtc.so modprobe.so hotplug.so; do - find "$SYSROOT" -name $plugin -delete + find "$SYSROOT" -name $plugin -delete done # Drop system .conf files we don't need in test, same as above for conf in hotplug.conf; do - find "$SYSROOT" -name $conf -delete + find "$SYSROOT" -name $conf -delete done diff --git a/test/signal-service.sh b/test/signal-service.sh index ad402a46..8b9be367 100755 --- a/test/signal-service.sh +++ b/test/signal-service.sh @@ -7,10 +7,10 @@ TEST_DIR=$(dirname "$0") test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } # shellcheck source=/dev/null diff --git a/test/start-kill-service.sh b/test/start-kill-service.sh index 90b9a046..042e1c4d 100755 --- a/test/start-kill-service.sh +++ b/test/start-kill-service.sh @@ -8,10 +8,10 @@ TEST_DIR=$(dirname "$0") test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } # shellcheck source=/dev/null @@ -35,9 +35,9 @@ say 'Simulate service crash (kill -9 ..)' i=0 laps=1000 while [ $i -lt $laps ]; do - i=$((i + 1)) - say "Lap $i/$laps, killing service ..." # we have this, no sleep needed - run "slay service.sh" + i=$((i + 1)) + say "Lap $i/$laps, killing service ..." # we have this, no sleep needed + run "slay service.sh" done retry 'assert_new_pid service.sh /run/service.pid' diff --git a/test/start-stop-serv.sh b/test/start-stop-serv.sh index a622dd16..de18387a 100755 --- a/test/start-stop-serv.sh +++ b/test/start-stop-serv.sh @@ -5,51 +5,51 @@ TEST_DIR=$(dirname "$0") test_setup() { - say "Test start $(date)" + say "Test start $(date)" } test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } test_one() { - pidfn=$1 - service=$2 + pidfn=$1 + service=$2 - say "Add service stanza '$service' to $FINIT_CONF ..." - run "echo '$service' > $FINIT_CONF" + say "Add service stanza '$service' to $FINIT_CONF ..." + run "echo '$service' > $FINIT_CONF" - say 'Reload Finit' - #run "initctl debug" - run "initctl reload" - #run "initctl status" - #run "ps" + say 'Reload Finit' + #run "initctl debug" + run "initctl reload" + #run "initctl status" + #run "ps" - #run "initctl status" - #run "ps" - #run "initctl status serv" + #run "initctl status" + #run "ps" + #run "initctl status serv" - retry 'assert_num_children 1 serv' - retry "assert_has_pidfile $pidfn" 1 + retry 'assert_num_children 1 serv' + retry "assert_has_pidfile $pidfn" 1 - say 'Stop the service' - run "initctl stop serv" + say 'Stop the service' + run "initctl stop serv" - retry 'assert_num_children 0 serv' + retry 'assert_num_children 0 serv' - say 'Start the service again' - run "initctl start serv" + say 'Start the service again' + run "initctl start serv" - retry 'assert_num_children 1 serv' + retry 'assert_num_children 1 serv' - say "Done, drop service from $FINIT_CONF ..." - run "rm $FINIT_CONF" - run "initctl reload" + say "Done, drop service from $FINIT_CONF ..." + run "rm $FINIT_CONF" + run "initctl reload" } # shellcheck source=/dev/null diff --git a/test/start-stop-service-sub-config.sh b/test/start-stop-service-sub-config.sh index 0472afe7..65b8cc83 100755 --- a/test/start-stop-service-sub-config.sh +++ b/test/start-stop-service-sub-config.sh @@ -6,10 +6,10 @@ TEST_DIR=$(dirname "$0") test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_RCSD/service.conf" + say "Running test teardown." + run "rm -f $FINIT_RCSD/service.conf" } # shellcheck source=/dev/null diff --git a/test/start-stop-service.sh b/test/start-stop-service.sh index 01a0f950..dcc4131f 100755 --- a/test/start-stop-service.sh +++ b/test/start-stop-service.sh @@ -6,10 +6,10 @@ TEST_DIR=$(dirname "$0") test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } # shellcheck source=/dev/null diff --git a/test/start-stop-sysv.sh b/test/start-stop-sysv.sh index d80eb403..f20300ee 100755 --- a/test/start-stop-sysv.sh +++ b/test/start-stop-sysv.sh @@ -6,10 +6,10 @@ TEST_DIR=$(dirname "$0") test_teardown() { - say "Test done $(date)" + say "Test done $(date)" - say "Running test teardown." - run "rm -f $FINIT_CONF" + say "Running test teardown." + run "rm -f $FINIT_CONF" } # shellcheck source=/dev/null