File: pidfile.sh

package info (click to toggle)
finit 4.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,216 kB
  • sloc: ansic: 17,060; sh: 6,281; makefile: 532
file content (46 lines) | stat: -rwxr-xr-x 1,048 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Verify parsing of pid: argument

set -eu

TEST_DIR=$(dirname "$0")

test_teardown()
{
    say "Running test teardown."

    run "rm -f $FINIT_CONF" "/tmp/post"
}

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"
}

# shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh"

#run "initctl debug"
#run "ls -l /run/finit/cond/pid/ /lib/finit/plugins/"

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