~ubuntu-branches/ubuntu/wily/openvswitch/wily

« back to all changes in this revision

Viewing changes to tests/daemon.at

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-08-10 11:35:15 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20150810113515-575vj06oq29emxsn
Tags: 2.4.0~git20150810.97bab95-0ubuntu1
* New upstream snapshot from 2.4 branch:
  - d/*: Align any relevant packaging changes with upstream.
* d/*: wrap-and-sort.
* d/openvswitch-{common,vswitch}.install: Correct install location for
  bash completion files.
* d/tests/openflow.py: Explicitly use ovs-testcontroller as provided
  by 2.4.0 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
AT_BANNER([daemon unit tests - C])
2
2
 
3
3
AT_SETUP([daemon])
 
4
AT_SKIP_IF([test "$IS_WIN32" = "yes"])
4
5
OVSDB_INIT([db])
5
6
AT_CAPTURE_FILE([pid])
6
7
AT_CAPTURE_FILE([expected])
19
20
AT_CLEANUP
20
21
 
21
22
AT_SETUP([daemon --monitor])
 
23
AT_SKIP_IF([test "$IS_WIN32" = "yes"])
22
24
OVSDB_INIT([db])
23
25
AT_CAPTURE_FILE([pid])
24
26
AT_CAPTURE_FILE([parent])
77
79
AT_CHECK([kill -0 `cat pid`])
78
80
# Kill the daemon and make sure that the pidfile gets deleted.
79
81
cp pid saved-pid
80
 
kill `cat pid`
 
82
if test "$IS_WIN32" = "yes"; then
 
83
  # When a 'kill pid' is done on windows (through 'taskkill //F'),
 
84
  # pidfiles are not deleted (because it is force kill), so use
 
85
  # 'ovs-appctl exit' instead
 
86
  ovs-appctl -t `pwd`/unixctl exit
 
87
else
 
88
  kill `cat pid`
 
89
fi
81
90
OVS_WAIT_WHILE([kill -0 `cat saved-pid`])
82
91
AT_CHECK([test ! -e pid])
83
92
AT_CLEANUP
84
93
 
85
94
AT_SETUP([daemon --detach --monitor])
 
95
AT_SKIP_IF([test "$IS_WIN32" = "yes"])
86
96
m4_define([CHECK], 
87
97
  [AT_CHECK([$1], [$2], [$3], [$4], [kill `cat daemon monitor`])])
88
98
OVSDB_INIT([db])
141
151
AT_CLEANUP
142
152
 
143
153
AT_SETUP([daemon --detach --monitor startup errors])
 
154
AT_SKIP_IF([test "$IS_WIN32" = "yes"])
144
155
AT_CAPTURE_FILE([pid])
145
156
OVSDB_INIT([db])
146
157
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile="`pwd`"/pid --monitor --unixctl="`pwd`"/nonexistent/unixctl db], [1], [], [stderr])
148
159
  [0], [ignore], [])
149
160
AT_CHECK([test ! -s pid])
150
161
AT_CLEANUP
 
162
 
 
163
AT_SETUP([daemon --service])
 
164
AT_KEYWORDS([windows-service])
 
165
AT_SKIP_IF([test "$IS_WIN32" != "yes"])
 
166
OVSDB_INIT([db])
 
167
AT_CAPTURE_FILE([pid])
 
168
# To create a Windows service, we need the absolute path for the executable.
 
169
abs_path="$(cd $(dirname `which ovsdb-server`); pwd -W; cd $OLDPWD)"
 
170
 
 
171
AT_CHECK([sc create ovsdb-server binpath="$abs_path/ovsdb-server `pwd`/db --log-file=`pwd`/ovsdb-server.log --pidfile=`pwd`/pid --remote=punix:`pwd`/socket --unixctl=`pwd`/unixctl --service"],
 
172
[0], [[[SC]] CreateService SUCCESS
 
173
])
 
174
 
 
175
AT_CHECK([sc start ovsdb-server], [0], [ignore])
 
176
OVS_WAIT_UNTIL([test -s pid])
 
177
OVS_WAIT_UNTIL([sc query ovsdb-server | grep STATE | grep RUNNING > /dev/null 2>&1])
 
178
AT_CHECK([kill -0 `cat pid`], [0], [ignore])
 
179
AT_CHECK([ovs-appctl -t `pwd`/unixctl ovsdb-server/list-dbs], [0],
 
180
[Open_vSwitch
 
181
])
 
182
AT_CHECK([sc stop ovsdb-server], [0], [ignore])
 
183
OVS_WAIT_UNTIL([test ! -s pid])
 
184
AT_CHECK([sc query ovsdb-server | grep STATE | grep STOPPED], [0], [ignore])
 
185
AT_CHECK([sc delete ovsdb-server], [0], [[[SC]] DeleteService SUCCESS
 
186
])
 
187
AT_CLEANUP