File: lsb-test.sh

package info (click to toggle)
lsb 11.6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 236 kB
  • sloc: python: 1,162; sh: 143; perl: 6; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 756 bytes parent folder | download | duplicates (5)
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
#!/bin/sh -e

echo "Importing $1/init-functions"
. $1/init-functions

log_warning_msg "Only a warning"
log_success_msg "This should succeed"
log_failure_msg "This fails miserably"

echo "OK!"

# Test pidofproc sanity checking.

echo "Testing pidofproc command line checks"

echo " Simple check, no options:"
pidofproc nonexistent
RETVAL=$?
if [ $RETVAL -ne 3 ]; then
    echo "Unexpected return value $RETVAL"
fi

echo " With -p option:"
pidofproc -p /var/run/nonexist.pid nonexistent
RETVAL=$?
if [ $RETVAL -ne 3 ]; then
    echo "Unexpected return value $RETVAL"
fi

echo " With -p option, but in wrong place:"
pidofproc nonexistent -p /var/run/nonexist.pid
RETVAL=$?
if [ $RETVAL -ne 4 ]; then
    echo "Unexpected return value $RETVAL"
fi

echo "OK!"