]>
Commit | Line | Data |
---|---|---|
8ed182d8 EJ |
1 | AT_BANNER([vlog]) |
2 | ||
d13c05ee RB |
3 | m4_define([VLOG_PYN], |
4 | [AT_SETUP([vlog - $1]) | |
5 | AT_SKIP_IF([test $2 = no]) | |
6 | AT_CAPTURE_FILE([log_file]) | |
7 | AT_CAPTURE_FILE([stderr_log]) | |
8 | AT_CHECK([$3 $srcdir/test-vlog.py --log-file log_file \ | |
ea523221 | 9 | -v dbg module_1:info module_2:warn syslog:off 2>stderr_log]) |
8ed182d8 | 10 | |
d13c05ee | 11 | AT_CHECK([sed -e 's/.*-.*-.*T..:..:..Z |//' \ |
7b7e43f5 | 12 | -e 's/File ".*", line [[0-9]][[0-9]]*,/File <name>, line <number>,/' \ |
8ed182d8 | 13 | stderr_log], [0], [dnl |
a5ed8fe3 DT |
14 | 0 | module_0 | EMER | emergency |
15 | 1 | module_0 | ERR | error | |
16 | 2 | module_0 | WARN | warning | |
17 | 3 | module_0 | INFO | information | |
18 | 4 | module_0 | DBG | debug | |
19 | 5 | module_0 | EMER | emergency exception | |
8ed182d8 EJ |
20 | Traceback (most recent call last): |
21 | File <name>, line <number>, in main | |
22 | assert fail | |
23 | AssertionError | |
a5ed8fe3 | 24 | 6 | module_0 | ERR | error exception |
8ed182d8 EJ |
25 | Traceback (most recent call last): |
26 | File <name>, line <number>, in main | |
27 | assert fail | |
28 | AssertionError | |
a5ed8fe3 | 29 | 7 | module_0 | WARN | warn exception |
8ed182d8 EJ |
30 | Traceback (most recent call last): |
31 | File <name>, line <number>, in main | |
32 | assert fail | |
33 | AssertionError | |
a5ed8fe3 | 34 | 8 | module_0 | INFO | information exception |
8ed182d8 EJ |
35 | Traceback (most recent call last): |
36 | File <name>, line <number>, in main | |
37 | assert fail | |
38 | AssertionError | |
a5ed8fe3 | 39 | 9 | module_0 | DBG | debug exception |
8ed182d8 EJ |
40 | Traceback (most recent call last): |
41 | File <name>, line <number>, in main | |
42 | assert fail | |
43 | AssertionError | |
a5ed8fe3 | 44 | 10 | module_0 | ERR | exception |
8ed182d8 EJ |
45 | Traceback (most recent call last): |
46 | File <name>, line <number>, in main | |
47 | assert fail | |
48 | AssertionError | |
a5ed8fe3 DT |
49 | 11 | module_1 | EMER | emergency |
50 | 12 | module_1 | ERR | error | |
51 | 13 | module_1 | WARN | warning | |
52 | 14 | module_1 | INFO | information | |
53 | 16 | module_1 | EMER | emergency exception | |
8ed182d8 EJ |
54 | Traceback (most recent call last): |
55 | File <name>, line <number>, in main | |
56 | assert fail | |
57 | AssertionError | |
a5ed8fe3 | 58 | 17 | module_1 | ERR | error exception |
8ed182d8 EJ |
59 | Traceback (most recent call last): |
60 | File <name>, line <number>, in main | |
61 | assert fail | |
62 | AssertionError | |
a5ed8fe3 | 63 | 18 | module_1 | WARN | warn exception |
8ed182d8 EJ |
64 | Traceback (most recent call last): |
65 | File <name>, line <number>, in main | |
66 | assert fail | |
67 | AssertionError | |
a5ed8fe3 | 68 | 19 | module_1 | INFO | information exception |
8ed182d8 EJ |
69 | Traceback (most recent call last): |
70 | File <name>, line <number>, in main | |
71 | assert fail | |
72 | AssertionError | |
a5ed8fe3 | 73 | 21 | module_1 | ERR | exception |
8ed182d8 EJ |
74 | Traceback (most recent call last): |
75 | File <name>, line <number>, in main | |
76 | assert fail | |
77 | AssertionError | |
a5ed8fe3 DT |
78 | 22 | module_2 | EMER | emergency |
79 | 23 | module_2 | ERR | error | |
80 | 24 | module_2 | WARN | warning | |
81 | 27 | module_2 | EMER | emergency exception | |
8ed182d8 EJ |
82 | Traceback (most recent call last): |
83 | File <name>, line <number>, in main | |
84 | assert fail | |
85 | AssertionError | |
a5ed8fe3 | 86 | 28 | module_2 | ERR | error exception |
8ed182d8 EJ |
87 | Traceback (most recent call last): |
88 | File <name>, line <number>, in main | |
89 | assert fail | |
90 | AssertionError | |
a5ed8fe3 | 91 | 29 | module_2 | WARN | warn exception |
8ed182d8 EJ |
92 | Traceback (most recent call last): |
93 | File <name>, line <number>, in main | |
94 | assert fail | |
95 | AssertionError | |
a5ed8fe3 | 96 | 32 | module_2 | ERR | exception |
8ed182d8 EJ |
97 | Traceback (most recent call last): |
98 | File <name>, line <number>, in main | |
99 | assert fail | |
100 | AssertionError | |
101 | ]) | |
102 | ||
d13c05ee RB |
103 | AT_CLEANUP]) |
104 | ||
105 | VLOG_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) | |
106 | VLOG_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) | |
8ba37945 | 107 | |
3c016b8b BP |
108 | m4_divert_push([PREPARE_TESTS]) |
109 | vlog_filt () { | |
110 | sed 's/.*\(opened log file\).*/\1/ | |
111 | s/.*|//' "$@" | |
112 | } | |
113 | m4_divert_pop([PREPARE_TESTS]) | |
114 | ||
115 | AT_SETUP([vlog - vlog/reopen - C]) | |
116 | # This test won't work as-is on Windows because Windows doesn't allow | |
117 | # files that are open to be renamed. | |
118 | AT_SKIP_IF([test "$IS_WIN32" = "yes"]) | |
119 | on_exit 'kill `cat test-unixctl.pid`' | |
120 | ||
121 | AT_CAPTURE_FILE([log]) | |
122 | AT_CAPTURE_FILE([log.old]) | |
123 | AT_CHECK([ovstest test-unixctl --log-file=`pwd`/log --pidfile --detach], | |
124 | [0], [], [stderr]) | |
125 | AT_CHECK([vlog_filt stderr], [0], | |
126 | [opened log file | |
127 | ]) | |
128 | ||
129 | AT_CHECK([APPCTL -t test-unixctl log message]) | |
130 | mv log log.old | |
131 | AT_CHECK([APPCTL -t test-unixctl log message2]) | |
132 | AT_CHECK([APPCTL -t test-unixctl vlog/reopen]) | |
133 | AT_CHECK([APPCTL -t test-unixctl log message3]) | |
134 | AT_CHECK([APPCTL -t test-unixctl exit]) | |
135 | ||
136 | AT_CHECK([vlog_filt log.old], [0], [dnl | |
137 | opened log file | |
138 | Entering run loop. | |
139 | message | |
140 | message2 | |
141 | closing log file | |
142 | ]) | |
143 | AT_CHECK([vlog_filt log], [0], [dnl | |
144 | opened log file | |
145 | message3 | |
146 | ]) | |
147 | AT_CLEANUP | |
148 | ||
d13c05ee RB |
149 | m4_define([VLOG_REOPEN_PYN], |
150 | [AT_SETUP([vlog - vlog/reopen - $1]) | |
151 | AT_SKIP_IF([test $2 = no]) | |
152 | on_exit 'kill `cat test-unixctl.py.pid`' | |
8ba37945 | 153 | |
d13c05ee RB |
154 | AT_CAPTURE_FILE([log]) |
155 | AT_CAPTURE_FILE([log.old]) | |
156 | AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach]) | |
8ba37945 | 157 | |
d13c05ee RB |
158 | AT_CHECK([APPCTL -t test-unixctl.py log message]) |
159 | mv log log.old | |
160 | AT_CHECK([APPCTL -t test-unixctl.py log message2]) | |
161 | AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen]) | |
162 | AT_CHECK([APPCTL -t test-unixctl.py log message3]) | |
163 | AT_CHECK([APPCTL -t test-unixctl.py exit]) | |
8ba37945 | 164 | |
d13c05ee | 165 | AT_CHECK([sed 's/.*|//' log.old], [0], [dnl |
a5ed8fe3 DT |
166 | Entering run loop. |
167 | message | |
168 | message2 | |
8ba37945 | 169 | ]) |
d13c05ee | 170 | AT_CHECK([sed 's/.*|//' log], [0], [dnl |
a5ed8fe3 | 171 | message3 |
8ba37945 | 172 | ]) |
d13c05ee RB |
173 | AT_CLEANUP]) |
174 | ||
175 | VLOG_REOPEN_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) | |
176 | VLOG_REOPEN_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) | |
8ba37945 | 177 | |
3c016b8b BP |
178 | AT_SETUP([vlog - vlog/reopen without log file - C]) |
179 | on_exit 'kill `cat test-unixctl.pid`' | |
180 | ||
181 | AT_CHECK([ovstest test-unixctl --pidfile --detach]) | |
182 | ||
183 | AT_CHECK([APPCTL -t test-unixctl vlog/reopen], [2], [], | |
184 | [Logging to file not configured | |
185 | ovs-appctl: test-unixctl: server returned an error | |
186 | ]) | |
187 | AT_CLEANUP | |
188 | ||
d13c05ee RB |
189 | m4_define([VLOG_REOPEN_WITHOUT_FILE_PYN], |
190 | [AT_SETUP([vlog - vlog/reopen without log file - $1]) | |
191 | AT_SKIP_IF([test $2 = no]) | |
192 | on_exit 'kill `cat test-unixctl.py.pid`' | |
8ba37945 | 193 | |
d13c05ee | 194 | AT_CHECK([$3 $srcdir/test-unixctl.py --pidfile --detach]) |
8ba37945 | 195 | |
d13c05ee RB |
196 | AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen], [0], |
197 | [Logging to file not configured | |
8ba37945 | 198 | ]) |
d13c05ee RB |
199 | AT_CLEANUP]) |
200 | ||
201 | VLOG_REOPEN_WITHOUT_FILE_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) | |
202 | VLOG_REOPEN_WITHOUT_FILE_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) | |
8ba37945 | 203 | |
3c016b8b BP |
204 | dnl This checks that if vlog/reopen can't reopen the log file, |
205 | dnl nothing particularly bad (e.g. a crash) happens. | |
206 | AT_SETUP([vlog - vlog/reopen can't reopen log file - C]) | |
207 | # Verify that /dev/full is a character device that fails writes. | |
208 | AT_SKIP_IF([test ! -c /dev/full]) | |
209 | AT_SKIP_IF([echo > /dev/full]) | |
210 | ||
211 | on_exit 'kill `cat test-unixctl.pid`' | |
212 | ||
213 | AT_CHECK([ovstest test-unixctl --log-file=`pwd`/log --pidfile --detach], | |
214 | [0], [], [stderr]) | |
215 | AT_CHECK([vlog_filt stderr], [0], [opened log file | |
216 | ]) | |
217 | ||
218 | AT_CHECK([APPCTL -t test-unixctl log message]) | |
219 | mv log log.old | |
220 | ln -s /dev/full log | |
221 | AT_CHECK([APPCTL -t test-unixctl vlog/reopen]) | |
222 | AT_CHECK([APPCTL -t test-unixctl log message2]) | |
223 | rm log | |
224 | AT_CHECK([APPCTL -t test-unixctl vlog/reopen]) | |
225 | AT_CHECK([APPCTL -t test-unixctl log message3]) | |
226 | AT_CHECK([APPCTL -t test-unixctl exit]) | |
227 | AT_CHECK([vlog_filt log.old], [0], [dnl | |
228 | opened log file | |
229 | Entering run loop. | |
230 | message | |
231 | closing log file | |
232 | ]) | |
233 | AT_CHECK([vlog_filt log], [0], [dnl | |
234 | opened log file | |
235 | message3 | |
236 | ]) | |
237 | AT_CLEANUP | |
238 | ||
8ba37945 BP |
239 | dnl This checks that if vlog/reopen can't reopen the log file, |
240 | dnl nothing particularly bad (e.g. Python throws an exception and | |
241 | dnl aborts the program) happens. | |
d13c05ee RB |
242 | m4_define([VLOG_CANT_REOPEN_PYN], |
243 | [AT_SETUP([vlog - vlog/reopen can't reopen log file - $1]) | |
244 | AT_SKIP_IF([test $2 = no]) | |
245 | ||
246 | # Verify that /dev/full is a character device that fails writes. | |
247 | AT_SKIP_IF([test ! -c /dev/full]) | |
248 | AT_SKIP_IF([echo > /dev/full]) | |
249 | ||
250 | on_exit 'kill `cat test-unixctl.py.pid`' | |
251 | ||
252 | AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach]) | |
253 | AT_CHECK([APPCTL -t test-unixctl.py log message]) | |
254 | mv log log.old | |
255 | ln -s /dev/full log | |
256 | AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen]) | |
257 | AT_CHECK([APPCTL -t test-unixctl.py log message2]) | |
258 | rm log | |
259 | AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen]) | |
260 | AT_CHECK([APPCTL -t test-unixctl.py log message3]) | |
261 | AT_CHECK([APPCTL -t test-unixctl.py exit]) | |
262 | AT_CHECK([sed 's/.*|//' log.old], [0], [dnl | |
a5ed8fe3 DT |
263 | Entering run loop. |
264 | message | |
8ba37945 | 265 | ]) |
d13c05ee | 266 | AT_CHECK([sed 's/.*|//' log], [0], [dnl |
a5ed8fe3 | 267 | message3 |
8ba37945 | 268 | ]) |
d13c05ee RB |
269 | AT_CLEANUP]) |
270 | ||
271 | VLOG_CANT_REOPEN_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) | |
272 | VLOG_CANT_REOPEN_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) | |
f26ddb5b | 273 | |
06380128 BP |
274 | AT_SETUP([vlog - vlog/close - C]) |
275 | on_exit 'kill `cat test-unixctl.pid`' | |
276 | ||
277 | AT_CAPTURE_FILE([log]) | |
278 | AT_CAPTURE_FILE([log.old]) | |
279 | AT_CHECK([ovstest test-unixctl --log-file=`pwd`/log --pidfile --detach], | |
280 | [0], [], [stderr]) | |
281 | AT_CHECK([vlog_filt stderr], [0], [opened log file | |
282 | ]) | |
283 | ||
284 | AT_CHECK([APPCTL -t test-unixctl log message]) | |
285 | AT_CHECK([APPCTL -t test-unixctl log message2]) | |
286 | ||
287 | # After closing the log file, message3 won't appear anywhere. | |
288 | AT_CHECK([APPCTL -t test-unixctl vlog/close]) | |
289 | mv log log.old | |
290 | AT_CHECK([APPCTL -t test-unixctl log message3]) | |
291 | ||
292 | # Closing the log file again is harmless. | |
293 | AT_CHECK([APPCTL -t test-unixctl vlog/close]) | |
294 | AT_CHECK([APPCTL -t test-unixctl log message4]) | |
295 | ||
296 | # After reopening the log file, further messages start appearing again. | |
297 | AT_CHECK([APPCTL -t test-unixctl vlog/reopen]) | |
298 | AT_CHECK([APPCTL -t test-unixctl log message5]) | |
299 | AT_CHECK([APPCTL -t test-unixctl exit]) | |
300 | ||
301 | AT_CHECK([vlog_filt log.old], [0], [dnl | |
302 | opened log file | |
303 | Entering run loop. | |
304 | message | |
305 | message2 | |
306 | ]) | |
307 | AT_CHECK([vlog_filt log], [0], [dnl | |
308 | opened log file | |
309 | message5 | |
310 | ]) | |
311 | AT_CLEANUP | |
312 | ||
d13c05ee RB |
313 | m4_define([VLOG_CLOSE_PYN], |
314 | [AT_SETUP([vlog - vlog/close - $1]) | |
315 | AT_SKIP_IF([test $2 = no]) | |
316 | on_exit 'kill `cat test-unixctl.py.pid`' | |
06380128 | 317 | |
d13c05ee RB |
318 | AT_CAPTURE_FILE([log]) |
319 | AT_CAPTURE_FILE([log.old]) | |
320 | AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach]) | |
06380128 | 321 | |
d13c05ee RB |
322 | AT_CHECK([APPCTL -t test-unixctl.py log message]) |
323 | AT_CHECK([APPCTL -t test-unixctl.py log message2]) | |
06380128 | 324 | |
d13c05ee RB |
325 | # After closing the log file, message3 won't appear anywhere. |
326 | AT_CHECK([APPCTL -t test-unixctl.py vlog/close]) | |
327 | mv log log.old | |
328 | AT_CHECK([APPCTL -t test-unixctl.py log message3]) | |
06380128 | 329 | |
d13c05ee RB |
330 | # Closing the log file again is harmless. |
331 | AT_CHECK([APPCTL -t test-unixctl.py vlog/close]) | |
332 | AT_CHECK([APPCTL -t test-unixctl.py log message4]) | |
06380128 | 333 | |
d13c05ee RB |
334 | # After reopening the log file, further messages start appearing again. |
335 | AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen]) | |
336 | AT_CHECK([APPCTL -t test-unixctl.py log message5]) | |
337 | AT_CHECK([APPCTL -t test-unixctl.py exit]) | |
06380128 | 338 | |
d13c05ee | 339 | AT_CHECK([sed 's/.*|//' log.old], [0], [dnl |
06380128 BP |
340 | Entering run loop. |
341 | message | |
342 | message2 | |
343 | ]) | |
d13c05ee | 344 | AT_CHECK([sed 's/.*|//' log], [0], [dnl |
06380128 BP |
345 | message5 |
346 | ]) | |
d13c05ee RB |
347 | AT_CLEANUP]) |
348 | ||
349 | VLOG_CLOSE_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) | |
350 | VLOG_CLOSE_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) | |
06380128 | 351 | |
3c016b8b BP |
352 | AT_SETUP([vlog - vlog/set and vlog/list - C]) |
353 | on_exit 'kill `cat test-unixctl.pid`' | |
354 | ||
355 | AT_CAPTURE_FILE([log]) | |
356 | AT_CHECK([ovstest test-unixctl --log-file=`pwd`/log --pidfile --detach], | |
357 | [0], [], [stderr]) | |
358 | AT_CHECK([vlog_filt stderr], [0], [opened log file | |
359 | ]) | |
360 | ||
361 | AT_CHECK([APPCTL -t test-unixctl vlog/list | sed -n '1,2p | |
362 | /\(test_unixctl\|daemon\) /p'], [0], [dnl | |
363 | console syslog file | |
364 | ------- ------ ------ | |
365 | daemon OFF INFO INFO | |
366 | test_unixctl OFF INFO INFO | |
367 | ]) | |
368 | ||
369 | AT_CHECK([APPCTL -t test-unixctl vlog/set daemon:syslog:err]) | |
370 | AT_CHECK([APPCTL -t test-unixctl vlog/set file:dbg]) | |
371 | AT_CHECK([APPCTL -t test-unixctl vlog/set nonexistent], [2], [], | |
372 | [no destination, level, or module "nonexistent" | |
373 | ovs-appctl: test-unixctl: server returned an error | |
374 | ]) | |
375 | AT_CHECK([APPCTL -t test-unixctl vlog/list | sed -n '1,2p | |
376 | /\(test_unixctl\|daemon\) /p'], [0], [dnl | |
377 | console syslog file | |
378 | ------- ------ ------ | |
379 | daemon OFF ERR DBG | |
380 | test_unixctl OFF INFO DBG | |
381 | ]) | |
382 | ||
383 | AT_CHECK([APPCTL -t test-unixctl vlog/set pattern], [2], [], | |
384 | [missing destination | |
385 | ovs-appctl: test-unixctl: server returned an error | |
386 | ]) | |
387 | AT_CHECK([APPCTL -t test-unixctl vlog/set pattern:nonexistent], [2], [], | |
388 | [unknown destination "nonexistent" | |
389 | ovs-appctl: test-unixctl: server returned an error | |
390 | ]) | |
391 | AT_CHECK([APPCTL -t test-unixctl vlog/set pattern:file:'I<3OVS|%m']) | |
392 | AT_CHECK([APPCTL -t test-unixctl log patterntest]) | |
393 | AT_CHECK([grep -q 'I<3OVS' log]) | |
394 | AT_CLEANUP | |
395 | ||
d13c05ee RB |
396 | m4_define([VLOG_SET_AND_LIST_PYN], |
397 | [AT_SETUP([vlog - vlog/set and vlog/list - $1]) | |
398 | AT_SKIP_IF([test $2 = no]) | |
399 | on_exit 'kill `cat test-unixctl.py.pid`' | |
f26ddb5b | 400 | |
d13c05ee RB |
401 | AT_CAPTURE_FILE([log]) |
402 | AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach]) | |
f26ddb5b | 403 | |
d13c05ee | 404 | AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl |
f26ddb5b BP |
405 | console syslog file |
406 | ------- ------ ------ | |
407 | daemon info info info | |
408 | fatal-signal info info info | |
409 | jsonrpc info info info | |
410 | poller info info info | |
411 | reconnect info info info | |
412 | socket_util info info info | |
413 | stream info info info | |
414 | test-unixctl info info info | |
415 | unixctl_server info info info | |
416 | ]) | |
417 | ||
d13c05ee RB |
418 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set daemon:syslog:err]) |
419 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set file:dbg]) | |
420 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set nonexistent], [0], | |
d5460484 | 421 | [no destination, level, or module "nonexistent" |
f26ddb5b | 422 | ]) |
d13c05ee | 423 | AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl |
f26ddb5b BP |
424 | console syslog file |
425 | ------- ------ ------ | |
426 | daemon info err dbg | |
427 | fatal-signal info info dbg | |
428 | jsonrpc info info dbg | |
429 | poller info info dbg | |
430 | reconnect info info dbg | |
431 | socket_util info info dbg | |
432 | stream info info dbg | |
433 | test-unixctl info info dbg | |
434 | unixctl_server info info dbg | |
435 | ]) | |
a5ed8fe3 | 436 | |
d13c05ee | 437 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern], [0], |
d5460484 | 438 | [Please supply a valid pattern and destination |
a5ed8fe3 | 439 | ]) |
d13c05ee | 440 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern:nonexistent], [0], |
d5460484 | 441 | [Destination nonexistent does not exist |
a5ed8fe3 | 442 | ]) |
d13c05ee RB |
443 | AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern:file:'I<3OVS|%m']) |
444 | AT_CHECK([APPCTL -t test-unixctl.py log patterntest]) | |
445 | AT_CHECK([grep -q 'I<3OVS' log]) | |
446 | AT_CLEANUP]) | |
447 | ||
448 | VLOG_SET_AND_LIST_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) | |
449 | VLOG_SET_AND_LIST_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) | |
d69d61c7 GS |
450 | |
451 | AT_SETUP([vlog - RFC5424 facility]) | |
53eb8cb8 | 452 | on_exit 'kill `cat ovsdb-server.pid`' |
d69d61c7 GS |
453 | |
454 | dnl Create database. | |
455 | touch .conf.db.~lock~ | |
456 | AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema]) | |
457 | ||
458 | AT_CHECK([ovsdb-server --detach --no-chdir --pidfile \ | |
459 | --remote=punix:$OVS_RUNDIR/db.sock -vPATTERN:file:"<%B>1 %A %m" \ | |
460 | --log-file], [0], [], [stderr]) | |
461 | AT_CHECK([ovs-appctl -t ovsdb-server exit]) | |
462 | ||
463 | # A default facility of LOG_LOCAL0 while writing to file. | |
38b0b29f | 464 | AT_CHECK([head -1 ovsdb-server.log | awk '{print $1}'], [0], [<133>1 |
d69d61c7 GS |
465 | ]) |
466 | rm ovsdb-server.log | |
467 | ||
468 | AT_CHECK([ovsdb-server --detach --no-chdir --pidfile \ | |
469 | --remote=punix:$OVS_RUNDIR/db.sock -vPATTERN:file:"<%B>1 %A %m" \ | |
470 | -vFACILITY:daemon --log-file], [0], [], [stderr]) | |
471 | ||
38b0b29f | 472 | AT_CHECK([head -1 ovsdb-server.log | awk '{print $1}'], [0], [<29>1 |
d69d61c7 GS |
473 | ]) |
474 | ||
475 | AT_CHECK([ovs-appctl -t ovsdb-server vlog/set FACILITY:invalid], [2], [], | |
476 | [invalid facility | |
477 | ovs-appctl: ovsdb-server: server returned an error | |
478 | ]) | |
479 | ||
480 | AT_CHECK([ovs-appctl -t ovsdb-server vlog/set FACILITY:local7]) | |
481 | AT_CHECK([ovs-appctl -t ovsdb-server vlog/set ANY:file:DBG]) | |
482 | AT_CHECK([ovs-appctl -t ovsdb-server exit]) | |
483 | ||
38b0b29f | 484 | AT_CHECK([tail -1 ovsdb-server.log | awk '{print $1}'], [0], [<191>1 |
d69d61c7 GS |
485 | ]) |
486 | AT_CLEANUP | |
487 | ||
d13c05ee RB |
488 | m4_define([VLOG_RFC5424_PYN], |
489 | [AT_SETUP([vlog - RFC5424 facility - $1]) | |
490 | AT_SKIP_IF([test $2 = no]) | |
491 | on_exit 'kill `cat test-unixctl.py.pid`' | |
d69d61c7 | 492 | |
d13c05ee | 493 | AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \ |
d69d61c7 GS |
494 | -vFACILITY:invalid --detach], [1], [], [test-unixctl.py: processing "FACILITY:invalid": Facility invalid is invalid |
495 | ]) | |
496 | ||
d13c05ee | 497 | AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \ |
d69d61c7 GS |
498 | -vFACILITY:daemon --detach]) |
499 | ||
d13c05ee | 500 | AT_CHECK([ovs-appctl -t test-unixctl.py vlog/set FACILITY:invalid], [0], |
d69d61c7 GS |
501 | [Facility invalid is invalid |
502 | ]) | |
503 | ||
d13c05ee RB |
504 | AT_CHECK([ovs-appctl -t test-unixctl.py vlog/set FACILITY:local0]) |
505 | AT_CLEANUP]) | |
506 | ||
507 | VLOG_RFC5424_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) | |
508 | VLOG_RFC5424_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) |