3 m4_define([APPCTL], [ovs-appctl --timeout 20])
4 m4_define([PYAPPCTL], [$PYTHON $srcdir/appctl.py --timeout 20])
6 AT_SETUP([unixctl ovs-vswitchd exit - Python])
7 AT_SKIP_IF([test $HAVE_PYTHON = no])
10 AT_CHECK([PYAPPCTL -t ovs-vswitchd exit], [0], [])
11 OVS_WAIT_WHILE([test -s ovs-vswitchd.pid])
13 AT_CHECK([PYAPPCTL -t ovsdb-server exit], [0], [])
14 OVS_WAIT_WHILE([test -s ovsdb-server.pid])
17 AT_SETUP([unixctl ovs-vswitchd help - Python])
18 AT_SKIP_IF([test $HAVE_PYTHON = no])
21 AT_CHECK([APPCTL help], [0], [stdout])
22 AT_CHECK([head -1 stdout], [0], [dnl
23 The available commands are:
26 AT_CHECK([PYAPPCTL help], [0], [expout])
32 AT_SETUP([unixctl ovs-vswitchd arguments - Python])
33 AT_SKIP_IF([test $HAVE_PYTHON = no])
36 AT_CHECK([APPCTL bond/hash], [2], [], [stderr])
37 AT_CHECK([head -1 stderr], [0], [dnl
38 "bond/hash" command requires at least 1 arguments
40 sed 's/ovs-appctl/appctl.py/' stderr > experr
41 AT_CHECK([PYAPPCTL bond/hash], [2], [], [experr])
43 AT_CHECK([APPCTL bond/hash mac], [2], [], [stderr])
44 AT_CHECK([head -1 stderr], [0], [dnl
47 sed 's/ovs-appctl/appctl.py/' stderr > experr
48 AT_CHECK([PYAPPCTL bond/hash mac], [2], [], [experr])
50 AT_CHECK([APPCTL bond/hash mac vlan], [2], [], [stderr])
51 AT_CHECK([head -1 stderr], [0], [dnl
54 sed 's/ovs-appctl/appctl.py/' stderr > experr
55 AT_CHECK([PYAPPCTL bond/hash mac vlan], [2], [], [experr])
57 AT_CHECK([APPCTL bond/hash mac vlan basis], [2], [], [stderr])
58 AT_CHECK([head -1 stderr], [0], [dnl
61 sed 's/ovs-appctl/appctl.py/' stderr > experr
62 AT_CHECK([PYAPPCTL bond/hash vlan basis], [2], [], [experr])
64 AT_CHECK([APPCTL bond/hash mac vlan basis extra], [2], [], [stderr])
65 AT_CHECK([head -1 stderr], [0], [dnl
66 "bond/hash" command takes at most 3 arguments
68 sed 's/ovs-appctl/appctl.py/' stderr > experr
69 AT_CHECK([PYAPPCTL bond/hash mac vlan basis extra], [2], [], [experr])
74 AT_SETUP([unixctl bad target - Python])
75 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
76 OVS_DBDIR=`pwd`; export OVS_DBDIR
77 AT_SKIP_IF([test $HAVE_PYTHON = no])
79 AT_CHECK([PYAPPCTL -t bogus doit], [1], [], [stderr])
80 AT_CHECK_UNQUOTED([tail -1 stderr], [0], [dnl
81 appctl.py: cannot read pidfile "`pwd`/bogus.pid" (No such file or directory)
84 AT_CHECK([PYAPPCTL -t /bogus/path.pid doit], [1], [], [stderr])
85 AT_CHECK([tail -1 stderr], [0], [dnl
86 appctl.py: cannot connect to "/bogus/path.pid" (No such file or directory)
91 AT_SETUP([unixctl server - Python])
92 AT_SKIP_IF([test $HAVE_PYTHON = no])
93 OVS_RUNDIR=`pwd`; export OVS_RUNDIR
94 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
95 OVS_DBDIR=`pwd`; export OVS_DBDIR
96 OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
97 ON_EXIT([kill `cat test-unixctl.py.pid`])
98 AT_CAPTURE_FILE([`pwd`/test-unixctl.py.log])
99 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file --pidfile --detach])
101 AT_CHECK([APPCTL -t test-unixctl.py help], [0], [stdout])
102 AT_CHECK([cat stdout], [0], [dnl
103 The available commands are:
106 echo_error [[arg ...]]
116 AT_CHECK([PYAPPCTL -t test-unixctl.py help], [0], [expout])
118 AT_CHECK([ovs-vsctl --version | sed 's/ovs-vsctl/test-unixctl.py/' | head -1 > expout])
119 AT_CHECK([APPCTL -t test-unixctl.py version], [0], [expout])
120 AT_CHECK([PYAPPCTL -t test-unixctl.py version], [0], [expout])
122 AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja], [0], [stdout])
123 AT_CHECK([cat stdout], [0], [dnl
124 [[u'robot', u'ninja']]
127 AT_CHECK([PYAPPCTL -t test-unixctl.py echo robot ninja], [0], [expout])
129 AT_CHECK([APPCTL -t test-unixctl.py echo_error robot ninja], [2], [], [stderr])
130 AT_CHECK([cat stderr], [0], [dnl
131 [[u'robot', u'ninja']]
132 ovs-appctl: test-unixctl.py: server returned an error
134 sed 's/ovs-appctl/appctl.py/' stderr > experr
135 AT_CHECK([PYAPPCTL -t test-unixctl.py echo_error robot ninja], [2], [], [experr])
137 AT_CHECK([APPCTL -t test-unixctl.py echo], [2], [], [stderr])
138 AT_CHECK([cat stderr], [0], [dnl
139 "echo" command requires at least 1 arguments
140 ovs-appctl: test-unixctl.py: server returned an error
142 sed 's/ovs-appctl/appctl.py/' stderr > experr
143 AT_CHECK([PYAPPCTL -t test-unixctl.py echo], [2], [], [experr])
145 AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja pirates], [2], [], [stderr])
146 AT_CHECK([cat stderr], [0], [dnl
147 "echo" command takes at most 2 arguments
148 ovs-appctl: test-unixctl.py: server returned an error
150 sed 's/ovs-appctl/appctl.py/' stderr > experr
151 AT_CHECK([PYAPPCTL -t test-unixctl.py echo robot ninja pirates], [2], [], [experr])
153 AT_CHECK([APPCTL -t test-unixctl.py bogus], [2], [], [stderr])
154 AT_CHECK([cat stderr], [0], [dnl
155 "bogus" is not a valid command
156 ovs-appctl: test-unixctl.py: server returned an error
158 sed 's/ovs-appctl/appctl.py/' stderr > experr
159 AT_CHECK([PYAPPCTL -t test-unixctl.py bogus], [2], [], [experr])
161 AT_CHECK([APPCTL -t test-unixctl.py exit])
165 AT_SETUP([unixctl server errors - Python])
166 AT_SKIP_IF([test $HAVE_PYTHON = no])
167 AT_CHECK($PYTHON $srcdir/test-unixctl.py --unixctl "`pwd`"/bogus/path, [1], [], [ignore])