3 AT_SETUP([vlog - Python])
4 AT_SKIP_IF([test $HAVE_PYTHON = no])
5 AT_CHECK([$PYTHON $srcdir/test-vlog.py --log-file log_file \
6 -v ANY:ANY:dbg module_1:ANY:info module_2:ANY:warn ANY:syslog:off \
8 AT_CAPTURE_FILE([log_file])
9 AT_CAPTURE_FILE([stderr_log])
11 AT_CHECK([diff log_file stderr_log])
13 AT_CHECK([sed -e 's/.* .* ..:..:..|//' \
14 -e 's/File ".*", line [[0-9]][[0-9]]*,/File <name>, line <number>,/' \
15 stderr_log], [0], [dnl
16 0|module_0|EMER|emergency
18 2|module_0|WARN|warning
19 3|module_0|INFO|information
21 5|module_0|EMER|emergency exception
22 Traceback (most recent call last):
23 File <name>, line <number>, in main
26 6|module_0|ERR|error exception
27 Traceback (most recent call last):
28 File <name>, line <number>, in main
31 7|module_0|WARN|warn exception
32 Traceback (most recent call last):
33 File <name>, line <number>, in main
36 8|module_0|INFO|information exception
37 Traceback (most recent call last):
38 File <name>, line <number>, in main
41 9|module_0|DBG|debug exception
42 Traceback (most recent call last):
43 File <name>, line <number>, in main
46 10|module_0|ERR|exception
47 Traceback (most recent call last):
48 File <name>, line <number>, in main
51 11|module_1|EMER|emergency
53 13|module_1|WARN|warning
54 14|module_1|INFO|information
55 16|module_1|EMER|emergency exception
56 Traceback (most recent call last):
57 File <name>, line <number>, in main
60 17|module_1|ERR|error exception
61 Traceback (most recent call last):
62 File <name>, line <number>, in main
65 18|module_1|WARN|warn exception
66 Traceback (most recent call last):
67 File <name>, line <number>, in main
70 19|module_1|INFO|information exception
71 Traceback (most recent call last):
72 File <name>, line <number>, in main
75 21|module_1|ERR|exception
76 Traceback (most recent call last):
77 File <name>, line <number>, in main
80 22|module_2|EMER|emergency
82 24|module_2|WARN|warning
83 27|module_2|EMER|emergency exception
84 Traceback (most recent call last):
85 File <name>, line <number>, in main
88 28|module_2|ERR|error exception
89 Traceback (most recent call last):
90 File <name>, line <number>, in main
93 29|module_2|WARN|warn exception
94 Traceback (most recent call last):
95 File <name>, line <number>, in main
98 32|module_2|ERR|exception
99 Traceback (most recent call last):
100 File <name>, line <number>, in main
107 AT_SETUP([vlog - vlog/reopen - Python])
108 AT_SKIP_IF([test $HAVE_PYTHON = no])
109 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
110 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
111 OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
112 trap 'kill `cat test-unixctl.py.pid`' 0
114 AT_CAPTURE_FILE([log])
115 AT_CAPTURE_FILE([log.old])
116 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach])
118 AT_CHECK([APPCTL -t test-unixctl.py log message])
120 AT_CHECK([APPCTL -t test-unixctl.py log message2])
121 AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
122 AT_CHECK([APPCTL -t test-unixctl.py log message3])
123 AT_CHECK([APPCTL -t test-unixctl.py exit])
126 AT_CHECK([sed 's/.*|//' log.old], [0], [dnl
131 AT_CHECK([sed 's/.*|//' log], [0], [dnl
136 AT_SETUP([vlog - vlog/reopen without log file - Python])
137 AT_SKIP_IF([test $HAVE_PYTHON = no])
138 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
139 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
140 OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
141 trap 'kill `cat test-unixctl.py.pid`' 0
143 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --pidfile --detach])
145 AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen], [0],
146 [Logging to file not configured
150 dnl This checks that if vlog/reopen can't reopen the log file,
151 dnl nothing particularly bad (e.g. Python throws an exception and
152 dnl aborts the program) happens.
153 AT_SETUP([vlog - vlog/reopen can't reopen log file - Python])
154 AT_SKIP_IF([test $HAVE_PYTHON = no])
156 # Verify that /dev/full is a character device that fails writes.
157 AT_SKIP_IF([test ! -c /dev/full])
158 AT_SKIP_IF([echo > /dev/full])
160 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
161 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
162 OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
163 trap 'kill `cat test-unixctl.py.pid`' 0
165 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach])
166 AT_CHECK([APPCTL -t test-unixctl.py log message])
169 AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
170 AT_CHECK([APPCTL -t test-unixctl.py log message2])
172 AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
173 AT_CHECK([APPCTL -t test-unixctl.py log message3])
174 AT_CHECK([APPCTL -t test-unixctl.py exit])
175 AT_CHECK([sed 's/.*|//' log.old], [0], [dnl
179 AT_CHECK([sed 's/.*|//' log], [0], [dnl
184 AT_SETUP([vlog - vlog/set and vlog/list - Python])
185 AT_SKIP_IF([test $HAVE_PYTHON = no])
186 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
187 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
188 OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
189 trap 'kill `cat test-unixctl.py.pid`' 0
191 AT_CAPTURE_FILE([log])
192 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach])
194 AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl
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
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],
211 [no facility, level, or module "nonexistent"
213 AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl
215 ------- ------ ------
217 fatal-signal info info dbg
218 jsonrpc info info dbg
220 reconnect info info dbg
221 socket_util info info dbg
223 test-unixctl info info dbg
224 unixctl_server info info dbg