]>
Commit | Line | Data |
---|---|---|
8ed182d8 EJ |
1 | AT_BANNER([vlog]) |
2 | ||
3 | AT_SETUP([vlog - Python]) | |
4 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
8ed182d8 EJ |
5 | AT_CAPTURE_FILE([log_file]) |
6 | AT_CAPTURE_FILE([stderr_log]) | |
ea523221 BP |
7 | AT_CHECK([$PYTHON $srcdir/test-vlog.py --log-file log_file \ |
8 | -v dbg module_1:info module_2:warn syslog:off 2>stderr_log]) | |
8ed182d8 | 9 | |
a5ed8fe3 | 10 | AT_CHECK([sed -e 's/.*-.*-.*T..:..:..Z |//' \ |
7b7e43f5 | 11 | -e 's/File ".*", line [[0-9]][[0-9]]*,/File <name>, line <number>,/' \ |
8ed182d8 | 12 | stderr_log], [0], [dnl |
a5ed8fe3 DT |
13 | 0 | module_0 | EMER | emergency |
14 | 1 | module_0 | ERR | error | |
15 | 2 | module_0 | WARN | warning | |
16 | 3 | module_0 | INFO | information | |
17 | 4 | module_0 | DBG | debug | |
18 | 5 | module_0 | EMER | emergency exception | |
8ed182d8 EJ |
19 | Traceback (most recent call last): |
20 | File <name>, line <number>, in main | |
21 | assert fail | |
22 | AssertionError | |
a5ed8fe3 | 23 | 6 | module_0 | ERR | error exception |
8ed182d8 EJ |
24 | Traceback (most recent call last): |
25 | File <name>, line <number>, in main | |
26 | assert fail | |
27 | AssertionError | |
a5ed8fe3 | 28 | 7 | module_0 | WARN | warn exception |
8ed182d8 EJ |
29 | Traceback (most recent call last): |
30 | File <name>, line <number>, in main | |
31 | assert fail | |
32 | AssertionError | |
a5ed8fe3 | 33 | 8 | module_0 | INFO | information exception |
8ed182d8 EJ |
34 | Traceback (most recent call last): |
35 | File <name>, line <number>, in main | |
36 | assert fail | |
37 | AssertionError | |
a5ed8fe3 | 38 | 9 | module_0 | DBG | debug exception |
8ed182d8 EJ |
39 | Traceback (most recent call last): |
40 | File <name>, line <number>, in main | |
41 | assert fail | |
42 | AssertionError | |
a5ed8fe3 | 43 | 10 | module_0 | ERR | exception |
8ed182d8 EJ |
44 | Traceback (most recent call last): |
45 | File <name>, line <number>, in main | |
46 | assert fail | |
47 | AssertionError | |
a5ed8fe3 DT |
48 | 11 | module_1 | EMER | emergency |
49 | 12 | module_1 | ERR | error | |
50 | 13 | module_1 | WARN | warning | |
51 | 14 | module_1 | INFO | information | |
52 | 16 | module_1 | EMER | emergency exception | |
8ed182d8 EJ |
53 | Traceback (most recent call last): |
54 | File <name>, line <number>, in main | |
55 | assert fail | |
56 | AssertionError | |
a5ed8fe3 | 57 | 17 | module_1 | ERR | error exception |
8ed182d8 EJ |
58 | Traceback (most recent call last): |
59 | File <name>, line <number>, in main | |
60 | assert fail | |
61 | AssertionError | |
a5ed8fe3 | 62 | 18 | module_1 | WARN | warn exception |
8ed182d8 EJ |
63 | Traceback (most recent call last): |
64 | File <name>, line <number>, in main | |
65 | assert fail | |
66 | AssertionError | |
a5ed8fe3 | 67 | 19 | module_1 | INFO | information exception |
8ed182d8 EJ |
68 | Traceback (most recent call last): |
69 | File <name>, line <number>, in main | |
70 | assert fail | |
71 | AssertionError | |
a5ed8fe3 | 72 | 21 | module_1 | ERR | exception |
8ed182d8 EJ |
73 | Traceback (most recent call last): |
74 | File <name>, line <number>, in main | |
75 | assert fail | |
76 | AssertionError | |
a5ed8fe3 DT |
77 | 22 | module_2 | EMER | emergency |
78 | 23 | module_2 | ERR | error | |
79 | 24 | module_2 | WARN | warning | |
80 | 27 | module_2 | EMER | emergency exception | |
8ed182d8 EJ |
81 | Traceback (most recent call last): |
82 | File <name>, line <number>, in main | |
83 | assert fail | |
84 | AssertionError | |
a5ed8fe3 | 85 | 28 | module_2 | ERR | error exception |
8ed182d8 EJ |
86 | Traceback (most recent call last): |
87 | File <name>, line <number>, in main | |
88 | assert fail | |
89 | AssertionError | |
a5ed8fe3 | 90 | 29 | module_2 | WARN | warn exception |
8ed182d8 EJ |
91 | Traceback (most recent call last): |
92 | File <name>, line <number>, in main | |
93 | assert fail | |
94 | AssertionError | |
a5ed8fe3 | 95 | 32 | module_2 | ERR | exception |
8ed182d8 EJ |
96 | Traceback (most recent call last): |
97 | File <name>, line <number>, in main | |
98 | assert fail | |
99 | AssertionError | |
100 | ]) | |
101 | ||
102 | AT_CLEANUP | |
8ba37945 BP |
103 | |
104 | AT_SETUP([vlog - vlog/reopen - Python]) | |
105 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
106 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR | |
107 | OVS_LOGDIR=`pwd`; export OVS_LOGDIR | |
f973f2af | 108 | OVS_DBDIR=`pwd`; export OVS_DBDIR |
8ba37945 | 109 | OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR |
0b7140bb | 110 | ON_EXIT([kill `cat test-unixctl.py.pid`]) |
8ba37945 BP |
111 | |
112 | AT_CAPTURE_FILE([log]) | |
113 | AT_CAPTURE_FILE([log.old]) | |
114 | AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach]) | |
115 | ||
116 | AT_CHECK([APPCTL -t test-unixctl.py log message]) | |
117 | mv log log.old | |
118 | AT_CHECK([APPCTL -t test-unixctl.py log message2]) | |
119 | AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen]) | |
120 | AT_CHECK([APPCTL -t test-unixctl.py log message3]) | |
121 | AT_CHECK([APPCTL -t test-unixctl.py exit]) | |
8ba37945 BP |
122 | |
123 | AT_CHECK([sed 's/.*|//' log.old], [0], [dnl | |
a5ed8fe3 DT |
124 | Entering run loop. |
125 | message | |
126 | message2 | |
8ba37945 BP |
127 | ]) |
128 | AT_CHECK([sed 's/.*|//' log], [0], [dnl | |
a5ed8fe3 | 129 | message3 |
8ba37945 BP |
130 | ]) |
131 | AT_CLEANUP | |
132 | ||
133 | AT_SETUP([vlog - vlog/reopen without log file - Python]) | |
134 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
135 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR | |
136 | OVS_LOGDIR=`pwd`; export OVS_LOGDIR | |
f973f2af | 137 | OVS_DBDIR=`pwd`; export OVS_DBDIR |
8ba37945 | 138 | OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR |
0b7140bb | 139 | ON_EXIT([kill `cat test-unixctl.py.pid`]) |
8ba37945 BP |
140 | |
141 | AT_CHECK([$PYTHON $srcdir/test-unixctl.py --pidfile --detach]) | |
142 | ||
143 | AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen], [0], | |
144 | [Logging to file not configured | |
145 | ]) | |
146 | AT_CLEANUP | |
147 | ||
148 | dnl This checks that if vlog/reopen can't reopen the log file, | |
149 | dnl nothing particularly bad (e.g. Python throws an exception and | |
150 | dnl aborts the program) happens. | |
151 | AT_SETUP([vlog - vlog/reopen can't reopen log file - Python]) | |
152 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
153 | ||
154 | # Verify that /dev/full is a character device that fails writes. | |
155 | AT_SKIP_IF([test ! -c /dev/full]) | |
156 | AT_SKIP_IF([echo > /dev/full]) | |
157 | ||
158 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR | |
159 | OVS_LOGDIR=`pwd`; export OVS_LOGDIR | |
f973f2af | 160 | OVS_DBDIR=`pwd`; export OVS_DBDIR |
8ba37945 | 161 | OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR |
0b7140bb | 162 | ON_EXIT([kill `cat test-unixctl.py.pid`]) |
8ba37945 BP |
163 | |
164 | AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach]) | |
165 | AT_CHECK([APPCTL -t test-unixctl.py log message]) | |
166 | mv log log.old | |
167 | ln -s /dev/full log | |
168 | AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen]) | |
169 | AT_CHECK([APPCTL -t test-unixctl.py log message2]) | |
170 | rm log | |
171 | AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen]) | |
172 | AT_CHECK([APPCTL -t test-unixctl.py log message3]) | |
173 | AT_CHECK([APPCTL -t test-unixctl.py exit]) | |
174 | AT_CHECK([sed 's/.*|//' log.old], [0], [dnl | |
a5ed8fe3 DT |
175 | Entering run loop. |
176 | message | |
8ba37945 BP |
177 | ]) |
178 | AT_CHECK([sed 's/.*|//' log], [0], [dnl | |
a5ed8fe3 | 179 | message3 |
8ba37945 BP |
180 | ]) |
181 | AT_CLEANUP | |
f26ddb5b BP |
182 | |
183 | AT_SETUP([vlog - vlog/set and vlog/list - Python]) | |
184 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
185 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR | |
186 | OVS_LOGDIR=`pwd`; export OVS_LOGDIR | |
f973f2af | 187 | OVS_DBDIR=`pwd`; export OVS_DBDIR |
f26ddb5b | 188 | OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR |
0b7140bb | 189 | ON_EXIT([kill `cat test-unixctl.py.pid`]) |
f26ddb5b BP |
190 | |
191 | AT_CAPTURE_FILE([log]) | |
192 | AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach]) | |
193 | ||
194 | AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl | |
195 | console syslog file | |
196 | ------- ------ ------ | |
197 | daemon info info info | |
198 | fatal-signal info info info | |
199 | jsonrpc info info info | |
200 | poller info info info | |
201 | reconnect info info info | |
202 | socket_util info info info | |
203 | stream info info info | |
204 | test-unixctl info info info | |
205 | unixctl_server info info info | |
206 | ]) | |
207 | ||
208 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set daemon:syslog:err]) | |
209 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set file:dbg]) | |
210 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set nonexistent], [0], | |
d5460484 | 211 | [no destination, level, or module "nonexistent" |
f26ddb5b BP |
212 | ]) |
213 | AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl | |
214 | console syslog file | |
215 | ------- ------ ------ | |
216 | daemon info err dbg | |
217 | fatal-signal info info dbg | |
218 | jsonrpc info info dbg | |
219 | poller info info dbg | |
220 | reconnect info info dbg | |
221 | socket_util info info dbg | |
222 | stream info info dbg | |
223 | test-unixctl info info dbg | |
224 | unixctl_server info info dbg | |
225 | ]) | |
a5ed8fe3 DT |
226 | |
227 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern], [0], | |
d5460484 | 228 | [Please supply a valid pattern and destination |
a5ed8fe3 DT |
229 | ]) |
230 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern:nonexistent], [0], | |
d5460484 | 231 | [Destination nonexistent does not exist |
a5ed8fe3 DT |
232 | ]) |
233 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern:file:'I<3OVS|%m']) | |
234 | AT_CHECK([APPCTL -t test-unixctl.py log patterntest]) | |
235 | AT_CHECK([grep -q 'I<3OVS' log]) | |
f26ddb5b | 236 | AT_CLEANUP |
d69d61c7 GS |
237 | |
238 | AT_SETUP([vlog - RFC5424 facility]) | |
239 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR | |
240 | OVS_LOGDIR=`pwd`; export OVS_LOGDIR | |
241 | OVS_DBDIR=`pwd`; export OVS_DBDIR | |
242 | OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR | |
243 | ON_EXIT([kill `cat ovsdb-server.pid`]) | |
244 | ||
245 | dnl Create database. | |
246 | touch .conf.db.~lock~ | |
247 | AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema]) | |
248 | ||
249 | AT_CHECK([ovsdb-server --detach --no-chdir --pidfile \ | |
250 | --remote=punix:$OVS_RUNDIR/db.sock -vPATTERN:file:"<%B>1 %A %m" \ | |
251 | --log-file], [0], [], [stderr]) | |
252 | AT_CHECK([ovs-appctl -t ovsdb-server exit]) | |
253 | ||
254 | # A default facility of LOG_LOCAL0 while writing to file. | |
255 | AT_CHECK([cat ovsdb-server.log | head -1 | awk '{print $1}'], [0], [<133>1 | |
256 | ]) | |
257 | rm ovsdb-server.log | |
258 | ||
259 | AT_CHECK([ovsdb-server --detach --no-chdir --pidfile \ | |
260 | --remote=punix:$OVS_RUNDIR/db.sock -vPATTERN:file:"<%B>1 %A %m" \ | |
261 | -vFACILITY:daemon --log-file], [0], [], [stderr]) | |
262 | ||
263 | AT_CHECK([cat ovsdb-server.log | head -1 | awk '{print $1}'], [0], [<29>1 | |
264 | ]) | |
265 | ||
266 | AT_CHECK([ovs-appctl -t ovsdb-server vlog/set FACILITY:invalid], [2], [], | |
267 | [invalid facility | |
268 | ovs-appctl: ovsdb-server: server returned an error | |
269 | ]) | |
270 | ||
271 | AT_CHECK([ovs-appctl -t ovsdb-server vlog/set FACILITY:local7]) | |
272 | AT_CHECK([ovs-appctl -t ovsdb-server vlog/set ANY:file:DBG]) | |
273 | AT_CHECK([ovs-appctl -t ovsdb-server exit]) | |
274 | ||
275 | AT_CHECK([cat ovsdb-server.log | tail -1 | awk '{print $1}'], [0], [<191>1 | |
276 | ]) | |
277 | AT_CLEANUP | |
278 | ||
279 | AT_SETUP([vlog - RFC5424 facility - Python]) | |
280 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
281 | OVS_RUNDIR=`pwd`; export OVS_RUNDIR | |
282 | OVS_LOGDIR=`pwd`; export OVS_LOGDIR | |
283 | OVS_DBDIR=`pwd`; export OVS_DBDIR | |
284 | OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR | |
285 | ON_EXIT([kill `cat test-unixctl.py.pid`]) | |
286 | ||
287 | AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \ | |
288 | -vFACILITY:invalid --detach], [1], [], [test-unixctl.py: processing "FACILITY:invalid": Facility invalid is invalid | |
289 | ]) | |
290 | ||
291 | AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \ | |
292 | -vFACILITY:daemon --detach]) | |
293 | ||
294 | AT_CHECK([ovs-appctl -t test-unixctl.py vlog/set FACILITY:invalid], [0], | |
295 | [Facility invalid is invalid | |
296 | ]) | |
297 | ||
298 | AT_CHECK([ovs-appctl -t test-unixctl.py vlog/set FACILITY:local0]) | |
299 | AT_CLEANUP |