3 AT_SETUP([vlog - Python])
4 AT_SKIP_IF([test $HAVE_PYTHON = no])
5 AT_CAPTURE_FILE([log_file])
6 AT_CAPTURE_FILE([stderr_log])
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])
10 AT_CHECK([diff log_file stderr_log])
12 AT_CHECK([sed -e 's/.*-.*-.*T..:..:..Z|//' \
13 -e 's/File ".*", line [[0-9]][[0-9]]*,/File <name>, line <number>,/' \
14 stderr_log], [0], [dnl
15 0|module_0|EMER|emergency
17 2|module_0|WARN|warning
18 3|module_0|INFO|information
20 5|module_0|EMER|emergency exception
21 Traceback (most recent call last):
22 File <name>, line <number>, in main
25 6|module_0|ERR|error exception
26 Traceback (most recent call last):
27 File <name>, line <number>, in main
30 7|module_0|WARN|warn exception
31 Traceback (most recent call last):
32 File <name>, line <number>, in main
35 8|module_0|INFO|information exception
36 Traceback (most recent call last):
37 File <name>, line <number>, in main
40 9|module_0|DBG|debug exception
41 Traceback (most recent call last):
42 File <name>, line <number>, in main
45 10|module_0|ERR|exception
46 Traceback (most recent call last):
47 File <name>, line <number>, in main
50 11|module_1|EMER|emergency
52 13|module_1|WARN|warning
53 14|module_1|INFO|information
54 16|module_1|EMER|emergency exception
55 Traceback (most recent call last):
56 File <name>, line <number>, in main
59 17|module_1|ERR|error exception
60 Traceback (most recent call last):
61 File <name>, line <number>, in main
64 18|module_1|WARN|warn exception
65 Traceback (most recent call last):
66 File <name>, line <number>, in main
69 19|module_1|INFO|information exception
70 Traceback (most recent call last):
71 File <name>, line <number>, in main
74 21|module_1|ERR|exception
75 Traceback (most recent call last):
76 File <name>, line <number>, in main
79 22|module_2|EMER|emergency
81 24|module_2|WARN|warning
82 27|module_2|EMER|emergency exception
83 Traceback (most recent call last):
84 File <name>, line <number>, in main
87 28|module_2|ERR|error exception
88 Traceback (most recent call last):
89 File <name>, line <number>, in main
92 29|module_2|WARN|warn exception
93 Traceback (most recent call last):
94 File <name>, line <number>, in main
97 32|module_2|ERR|exception
98 Traceback (most recent call last):
99 File <name>, line <number>, in main
106 AT_SETUP([vlog - vlog/reopen - Python])
107 AT_SKIP_IF([test $HAVE_PYTHON = no])
108 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
109 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
110 OVS_DBDIR=`pwd`; export OVS_DBDIR
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_DBDIR=`pwd`; export OVS_DBDIR
141 OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
142 trap 'kill `cat test-unixctl.py.pid`' 0
144 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --pidfile --detach])
146 AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen], [0],
147 [Logging to file not configured
151 dnl This checks that if vlog/reopen can't reopen the log file,
152 dnl nothing particularly bad (e.g. Python throws an exception and
153 dnl aborts the program) happens.
154 AT_SETUP([vlog - vlog/reopen can't reopen log file - Python])
155 AT_SKIP_IF([test $HAVE_PYTHON = no])
157 # Verify that /dev/full is a character device that fails writes.
158 AT_SKIP_IF([test ! -c /dev/full])
159 AT_SKIP_IF([echo > /dev/full])
161 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
162 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
163 OVS_DBDIR=`pwd`; export OVS_DBDIR
164 OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
165 trap 'kill `cat test-unixctl.py.pid`' 0
167 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach])
168 AT_CHECK([APPCTL -t test-unixctl.py log message])
171 AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
172 AT_CHECK([APPCTL -t test-unixctl.py log message2])
174 AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
175 AT_CHECK([APPCTL -t test-unixctl.py log message3])
176 AT_CHECK([APPCTL -t test-unixctl.py exit])
177 AT_CHECK([sed 's/.*|//' log.old], [0], [dnl
181 AT_CHECK([sed 's/.*|//' log], [0], [dnl
186 AT_SETUP([vlog - vlog/set and vlog/list - Python])
187 AT_SKIP_IF([test $HAVE_PYTHON = no])
188 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
189 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
190 OVS_DBDIR=`pwd`; export OVS_DBDIR
191 OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
192 trap 'kill `cat test-unixctl.py.pid`' 0
194 AT_CAPTURE_FILE([log])
195 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach])
197 AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl
199 ------- ------ ------
200 daemon info info info
201 fatal-signal info info info
202 jsonrpc info info info
203 poller info info info
204 reconnect info info info
205 socket_util info info info
206 stream info info info
207 test-unixctl info info info
208 unixctl_server info info info
211 AT_CHECK([APPCTL -t test-unixctl.py vlog/set daemon:syslog:err])
212 AT_CHECK([APPCTL -t test-unixctl.py vlog/set file:dbg])
213 AT_CHECK([APPCTL -t test-unixctl.py vlog/set nonexistent], [0],
214 [no facility, level, or module "nonexistent"
216 AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl
218 ------- ------ ------
220 fatal-signal info info dbg
221 jsonrpc info info dbg
223 reconnect info info dbg
224 socket_util info info dbg
226 test-unixctl info info dbg
227 unixctl_server info info dbg