1d2607f36ea1ed9e874947492aa5f7a00a663cd9
[samba.git] / ctdb / tests / cunit / sock_daemon_test_001.sh
1 #!/bin/sh
2
3 . "${TEST_SCRIPTS_DIR}/unit.sh"
4
5 pidfile="${TEST_VAR_DIR}/sock_daemon_test.pid.$$"
6 sockpath="${TEST_VAR_DIR}/sock_daemon_test.sock.$$"
7
8 remove_files ()
9 {
10         rm -f "$pidfile"
11         rm -f "$sockpath"
12 }
13
14 test_cleanup remove_files
15
16 result_filter ()
17 {
18         _pid="[0-9][0-9]*"
19         sed -e "s|pid=${_pid}|pid=PID|" \
20             -e "s|PID ${_pid}|PID PID|" \
21             -e "s|\[${_pid}\]|[PID]|"
22 }
23
24
25 ok <<EOF
26 test1[PID]: listening on $sockpath
27 EOF
28 unit_test sock_daemon_test "$pidfile" "$sockpath" 1
29
30 ok <<EOF
31 test2[PID]: listening on $sockpath
32 test2[PID]: daemon started, pid=PID
33 test2[PID]: Received signal 1
34 test2[PID]: Received signal 10
35 test2[PID]: Received signal 15
36 test2[PID]: Shutting down
37 EOF
38 unit_test sock_daemon_test "$pidfile" "$sockpath" 2
39
40 ok <<EOF
41 test3[PID]: listening on $sockpath
42 test3[PID]: daemon started, pid=PID
43 test3[PID]: PID PID gone away, exiting
44 test3[PID]: Shutting down
45 EOF
46 unit_test sock_daemon_test "$pidfile" "$sockpath" 3
47
48 ok <<EOF
49 test4[PID]: daemon started, pid=PID
50 test4[PID]: Shutting down
51 EOF
52 unit_test sock_daemon_test "$pidfile" "$sockpath" 4
53
54 ok <<EOF
55 test5[PID]: listening on $sockpath
56 test5[PID]: daemon started, pid=PID
57 test5[PID]: Received signal 15
58 test5[PID]: Shutting down
59 EOF
60 unit_test sock_daemon_test "$pidfile" "$sockpath" 5
61
62 ok <<EOF
63 test6[PID]: listening on $sockpath
64 test6[PID]: daemon started, pid=PID
65 test6[PID]: Shutting down
66 EOF
67 unit_test sock_daemon_test "$pidfile" "$sockpath" 6
68
69 ok <<EOF
70 test7[PID]: daemon started, pid=PID
71 test7[PID]: Received signal 15
72 test7[PID]: Shutting down
73 EOF
74 unit_test sock_daemon_test "$pidfile" "$sockpath" 7
75
76 ok <<EOF
77 test8[PID]: daemon started, pid=PID
78 test8[PID]: Received signal 15
79 test8[PID]: Shutting down
80 test8[PID]: daemon started, pid=PID
81 test8[PID]: Received signal 15
82 test8[PID]: Shutting down
83 EOF
84 unit_test sock_daemon_test "$pidfile" "$sockpath" 8
85
86 ok <<EOF
87 test9[PID]: daemon started, pid=PID
88 test9[PID]: Received signal 15
89 test9[PID]: Shutting down
90 test9[PID]: daemon started, pid=PID
91 test9[PID]: Received signal 15
92 test9[PID]: Shutting down
93 EOF
94 unit_test sock_daemon_test "$pidfile" "$sockpath" 9