mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 21:42:40 +07:00
test: new regression test, //run/foo.pid -> /var/run///run/foo.pid
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -28,6 +28,7 @@ EXTRA_DIST += failing-sysv.sh
|
||||
EXTRA_DIST += global-envs.sh
|
||||
EXTRA_DIST += initctl-status-subset.sh
|
||||
EXTRA_DIST += notify.sh
|
||||
EXTRA_DIST += pidfile.sh
|
||||
EXTRA_DIST += pre-post-serv.sh
|
||||
EXTRA_DIST += ready-serv.sh
|
||||
EXTRA_DIST += restart-self.sh
|
||||
@@ -64,6 +65,7 @@ TESTS += failing-sysv.sh
|
||||
TESTS += global-envs.sh
|
||||
TESTS += initctl-status-subset.sh
|
||||
TESTS += notify.sh
|
||||
TESTS += pidfile.sh
|
||||
TESTS += pre-post-serv.sh
|
||||
TESTS += ready-serv.sh
|
||||
TESTS += restart-self.sh
|
||||
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# Verify parsing of pid: argument
|
||||
|
||||
set -eu
|
||||
|
||||
TEST_DIR=$(dirname "$0")
|
||||
|
||||
test_setup()
|
||||
{
|
||||
say "Test start $(date)"
|
||||
}
|
||||
|
||||
test_teardown()
|
||||
{
|
||||
say "Test done $(date)"
|
||||
say "Running test teardown."
|
||||
|
||||
run "rm -f $FINIT_CONF" "/tmp/post"
|
||||
}
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. "$TEST_DIR/tenv/lib.sh"
|
||||
|
||||
#run "initctl debug"
|
||||
#run "ls -l /run/finit/cond/pid/ /lib/finit/plugins/"
|
||||
|
||||
test_one()
|
||||
{
|
||||
pidfn=$1
|
||||
service=$2
|
||||
|
||||
sep
|
||||
say "Add service stanza '$service' to $FINIT_CONF ..."
|
||||
run "echo '$service' > $FINIT_CONF"
|
||||
run "initctl reload"
|
||||
|
||||
assert_is_pidfile "serv" "$pidfn"
|
||||
|
||||
say "Done, drop service from $FINIT_CONF ..."
|
||||
run "rm $FINIT_CONF"
|
||||
run "initctl reload"
|
||||
}
|
||||
|
||||
test_one "/run/serv.pid" "service serv -np"
|
||||
test_one "/run/serv.pid" "service pid:!/run/serv.pid serv"
|
||||
test_one "/run/serv.pid" "service type:forking serv"
|
||||
test_one "/run/serv.pid" "service pid:!//run/serv.pid serv -np"
|
||||
test_one "/run/serv.pid" "service pid://run/serv.pid serv -n"
|
||||
test_one "/run/serv.pid" "service pid://../run/serv.pid serv -n"
|
||||
test_one "/run/serv.pid" "service pid://run/../run//serv.pid serv -n"
|
||||
|
||||
sep
|
||||
@@ -86,6 +86,11 @@ assert_nocond()
|
||||
assert "Condition $cond cleared" "$(texec initctl -v cond get "$cond")" = "off"
|
||||
}
|
||||
|
||||
assert_is_pidfile()
|
||||
{
|
||||
assert "Process has PID file: $2" "$(texec initctl -p status "$1" | awk '/PID file/{print $4}')" = "$2"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
assert_has_pidfile()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user