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 AT_SKIP_IF([test $HAVE_PYTHON = no])
78 AT_CHECK([PYAPPCTL -t bogus doit], [1], [], [stderr])
79 AT_CHECK_UNQUOTED([tail -1 stderr], [0], [dnl
80 appctl.py: cannot read pidfile "$PWD/bogus.pid" (No such file or directory)
83 AT_CHECK([PYAPPCTL -t /bogus/path.pid doit], [1], [], [stderr])
84 AT_CHECK([tail -1 stderr], [0], [dnl
85 appctl.py: cannot connect to "/bogus/path.pid" (No such file or directory)
90 AT_SETUP([unixctl server - Python])
91 AT_SKIP_IF([test $HAVE_PYTHON = no])
92 OVS_RUNDIR=$PWD; export OVS_RUNDIR
93 OVS_LOGDIR=$PWD; export OVS_LOGDIR
94 OVS_SYSCONFDIR=$PWD; export OVS_SYSCONFDIR
95 trap 'kill `cat test-unixctl.py.pid`' 0
96 AT_CAPTURE_FILE([$PWD/test-unixctl.py.log])
97 AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file --pidfile --detach])
99 AT_CHECK([APPCTL -t test-unixctl.py help], [0], [stdout])
100 AT_CHECK([cat stdout], [0], [dnl
101 The available commands are:
104 echo_error [[arg ...]]
110 AT_CHECK([PYAPPCTL -t test-unixctl.py help], [0], [expout])
112 AT_CHECK([echo "test-unixctl.py (Open vSwitch) $VERSION $BUILDNR" > expout])
113 AT_CHECK([APPCTL -t test-unixctl.py version], [0], [expout])
114 AT_CHECK([PYAPPCTL -t test-unixctl.py version], [0], [expout])
116 AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja], [0], [stdout])
117 AT_CHECK([cat stdout], [0], [dnl
118 [[u'robot', u'ninja']]
121 AT_CHECK([PYAPPCTL -t test-unixctl.py echo robot ninja], [0], [expout])
123 AT_CHECK([APPCTL -t test-unixctl.py echo_error robot ninja], [2], [], [stderr])
124 AT_CHECK([cat stderr], [0], [dnl
125 [[u'robot', u'ninja']]
126 ovs-appctl: test-unixctl.py: server returned an error
128 sed 's/ovs-appctl/appctl.py/' stderr > experr
129 AT_CHECK([PYAPPCTL -t test-unixctl.py echo_error robot ninja], [2], [], [experr])
131 AT_CHECK([APPCTL -t test-unixctl.py echo], [2], [], [stderr])
132 AT_CHECK([cat stderr], [0], [dnl
133 "echo" command requires at least 1 arguments
134 ovs-appctl: test-unixctl.py: server returned an error
136 sed 's/ovs-appctl/appctl.py/' stderr > experr
137 AT_CHECK([PYAPPCTL -t test-unixctl.py echo], [2], [], [experr])
139 AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja pirates], [2], [], [stderr])
140 AT_CHECK([cat stderr], [0], [dnl
141 "echo" command takes at most 2 arguments
142 ovs-appctl: test-unixctl.py: server returned an error
144 sed 's/ovs-appctl/appctl.py/' stderr > experr
145 AT_CHECK([PYAPPCTL -t test-unixctl.py echo robot ninja pirates], [2], [], [experr])
147 AT_CHECK([APPCTL -t test-unixctl.py bogus], [2], [], [stderr])
148 AT_CHECK([cat stderr], [0], [dnl
149 "bogus" is not a valid command
150 ovs-appctl: test-unixctl.py: server returned an error
152 sed 's/ovs-appctl/appctl.py/' stderr > experr
153 AT_CHECK([PYAPPCTL -t test-unixctl.py bogus], [2], [], [experr])
155 AT_CHECK([APPCTL -t test-unixctl.py exit])
160 AT_SETUP([unixctl server errors - Python])
161 AT_SKIP_IF([test $HAVE_PYTHON = no])
162 AT_CHECK($PYTHON $srcdir/test-unixctl.py --unixctl $PWD/bogus/path, [1], [], [ignore])