]>
Commit | Line | Data |
---|---|---|
1b233b95 BP |
1 | AT_INIT |
2 | ||
c40b890f | 3 | AT_COPYRIGHT([Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. |
1b233b95 BP |
4 | |
5 | Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | you may not use this file except in compliance with the License. | |
7 | You may obtain a copy of the License at: | |
8 | ||
9 | http://www.apache.org/licenses/LICENSE-2.0 | |
10 | ||
11 | Unless required by applicable law or agreed to in writing, software | |
12 | distributed under the License is distributed on an "AS IS" BASIS, | |
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | See the License for the specific language governing permissions and | |
15 | limitations under the License.]) | |
16 | ||
17 | AT_TESTED([ovs-vswitchd]) | |
3b135da3 | 18 | AT_TESTED([ovs-vsctl]) |
f85f8ebb | 19 | AT_TESTED([perl]) |
1b233b95 | 20 | |
0877a018 TG |
21 | m4_include([m4/compat.at]) |
22 | ||
f17e0c25 BP |
23 | m4_divert_push([PREPARE_TESTS]) |
24 | [ | |
25 | ovs_wait () { | |
26 | # First try a quick sleep, so that the test completes very quickly | |
27 | # in the normal case. POSIX doesn't require fractional times to | |
28 | # work, so this might not work. | |
29 | sleep 0.1 | |
30 | ovs_wait_cond && exit 0 | |
31 | # Then wait up to 10 seconds. | |
32 | for d in 0 1 2 3 4 5 6 7 8 9; do | |
33 | sleep 1 | |
34 | ovs_wait_cond && exit 0 | |
35 | done | |
36 | exit 1 | |
37 | } | |
535e8b04 BP |
38 | |
39 | # Prints the integers from $1 to $2, increasing by $3 (default 1) on stdout. | |
40 | seq () { | |
41 | while test $1 -le $2; do | |
42 | echo $1 | |
43 | set `expr $1 + ${3-1}` $2 $3 | |
44 | done | |
45 | } | |
038b21a1 GS |
46 | |
47 | if test "$IS_WIN32" = "yes"; then | |
48 | pwd () { | |
49 | command pwd -W "$@" | |
50 | } | |
b3c3eec7 | 51 | |
0d21340a GS |
52 | diff () { |
53 | command diff --strip-trailing-cr "$@" | |
54 | } | |
55 | ||
b3c3eec7 GS |
56 | kill () { |
57 | case "$1" in | |
58 | -0) | |
59 | shift | |
60 | for i in $*; do | |
61 | # tasklist will always have return code 0. | |
62 | # If pid does exist, there will be a line with the pid. | |
14073368 | 63 | if tasklist //fi "PID eq $i" | grep $i >/dev/null; then |
b3c3eec7 GS |
64 | : |
65 | else | |
66 | return 1 | |
67 | fi | |
68 | done | |
69 | return 0 | |
70 | ;; | |
71 | -[1-9]*) | |
72 | shift | |
73 | for i in $*; do | |
14073368 | 74 | taskkill //F //PID $i >/dev/null |
b3c3eec7 GS |
75 | done |
76 | ;; | |
14073368 | 77 | [1-9][0-9]*) |
b3c3eec7 | 78 | for i in $*; do |
14073368 | 79 | taskkill //F //PID $i >/dev/null |
b3c3eec7 GS |
80 | done |
81 | ;; | |
82 | esac | |
83 | } | |
038b21a1 | 84 | fi |
f17e0c25 BP |
85 | ] |
86 | m4_divert_pop([PREPARE_TESTS]) | |
87 | ||
f5961335 | 88 | m4_define([OVS_WAIT], |
b12e3c41 | 89 | [AT_CHECK( |
f17e0c25 BP |
90 | [ovs_wait_cond () { $1 |
91 | } | |
92 | ovs_wait], [0], [ignore], [ignore], [$2])]) | |
93 | m4_define([OVS_WAIT_UNTIL], [OVS_WAIT([$1], [$2])]) | |
94 | m4_define([OVS_WAIT_WHILE], | |
95 | [OVS_WAIT([if $1; then return 1; else return 0; fi], [$2])]) | |
b12e3c41 | 96 | |
0c473314 YT |
97 | dnl OVS_APP_EXIT_AND_WAIT(DAEMON) |
98 | dnl | |
99 | dnl Ask the daemon named DAEMON to exit, via ovs-appctl, and then waits for it | |
100 | dnl to exit. | |
101 | m4_define([OVS_APP_EXIT_AND_WAIT], | |
102 | [ovs-appctl -t $1 exit | |
103 | OVS_WAIT_WHILE([test -e $1.pid])]) | |
104 | ||
0b7140bb BP |
105 | dnl ON_EXIT([COMMANDS]) |
106 | dnl | |
107 | dnl Adds the shell COMMANDS to a collection executed when the current test | |
108 | dnl completes, as a cleanup action. (The most common use is to kill a | |
109 | dnl daemon started by the test. This is important to prevent tests that | |
110 | dnl start daemons from hanging at exit.) | |
111 | m4_define([ON_EXIT], [trap '. ./cleanup' 0; cat >>cleanup <<'EOF' | |
112 | $1 | |
113 | EOF | |
114 | ]) | |
115 | ||
24c8ae53 | 116 | m4_include([tests/ovsdb-macros.at]) |
0fbc9f11 | 117 | m4_include([tests/ofproto-macros.at]) |
24c8ae53 | 118 | |
015cf297 | 119 | m4_include([tests/bfd.at]) |
03f209ba | 120 | m4_include([tests/cfm.at]) |
742468d9 | 121 | m4_include([tests/lacp.at]) |
1b233b95 | 122 | m4_include([tests/library.at]) |
95974447 | 123 | m4_include([tests/heap.at]) |
daff3353 | 124 | m4_include([tests/bundle.at]) |
3223e977 | 125 | m4_include([tests/classifier.at]) |
05b3c97b | 126 | m4_include([tests/check-structs.at]) |
ff8decf1 | 127 | m4_include([tests/daemon.at]) |
99155935 | 128 | m4_include([tests/daemon-py.at]) |
f25d0cf3 | 129 | m4_include([tests/ofp-actions.at]) |
fec00620 | 130 | m4_include([tests/ofp-print.at]) |
681ea7a0 | 131 | m4_include([tests/ofp-util.at]) |
2e0525bc | 132 | m4_include([tests/ofp-errors.at]) |
0e581146 | 133 | m4_include([tests/ovs-ofctl.at]) |
3bffc610 | 134 | m4_include([tests/odp.at]) |
53ddd40a | 135 | m4_include([tests/multipath.at]) |
75a75043 | 136 | m4_include([tests/learn.at]) |
d27ce529 | 137 | m4_include([tests/vconn.at]) |
e1aff6f9 | 138 | m4_include([tests/file_name.at]) |
d918d9d1 | 139 | m4_include([tests/aes128.at]) |
0a68ffd2 | 140 | m4_include([tests/unixctl-py.at]) |
d918d9d1 | 141 | m4_include([tests/uuid.at]) |
f38b84ea | 142 | m4_include([tests/json.at]) |
f2129093 | 143 | m4_include([tests/jsonrpc.at]) |
99155935 | 144 | m4_include([tests/jsonrpc-py.at]) |
0f538378 | 145 | m4_include([tests/tunnel.at]) |
ac718c9d | 146 | m4_include([tests/lockfile.at]) |
3ed497fc | 147 | m4_include([tests/reconnect.at]) |
b7898031 | 148 | m4_include([tests/ovs-vswitchd.at]) |
a2cb9dfd | 149 | m4_include([tests/ofproto.at]) |
9c4044a5 | 150 | m4_include([tests/dpif-netdev.at]) |
29901626 | 151 | m4_include([tests/ofproto-dpif.at]) |
c40b890f | 152 | m4_include([tests/bridge.at]) |
1c3e353d | 153 | m4_include([tests/vlan-splinters.at]) |
f85f8ebb | 154 | m4_include([tests/ovsdb.at]) |
3b135da3 | 155 | m4_include([tests/ovs-vsctl.at]) |
b54bdbe9 | 156 | m4_include([tests/ovs-monitor-ipsec.at]) |
1b0fdca5 | 157 | m4_include([tests/ovs-xapi-sync.at]) |
48d014bf | 158 | m4_include([tests/interface-reconfigure.at]) |
829a7d02 | 159 | m4_include([tests/stp.at]) |
8ed182d8 | 160 | m4_include([tests/vlog.at]) |
ffc759c6 | 161 | m4_include([tests/vtep-ctl.at]) |