testsuite.at: pwd for windows.
[sliver-openvswitch.git] / tests / testsuite.at
1 AT_INIT
2
3 AT_COPYRIGHT([Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
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])
18 AT_TESTED([ovs-vsctl])
19 AT_TESTED([perl])
20
21 m4_divert_push([PREPARE_TESTS])
22 [
23 ovs_wait () {
24     # First try a quick sleep, so that the test completes very quickly
25     # in the normal case.  POSIX doesn't require fractional times to
26     # work, so this might not work.
27     sleep 0.1
28     ovs_wait_cond && exit 0
29     # Then wait up to 10 seconds.
30     for d in 0 1 2 3 4 5 6 7 8 9; do
31         sleep 1
32         ovs_wait_cond && exit 0
33     done
34     exit 1
35 }
36
37 # Prints the integers from $1 to $2, increasing by $3 (default 1) on stdout.
38 seq () {
39     while test $1 -le $2; do
40         echo $1
41         set `expr $1 + ${3-1}` $2 $3
42     done
43 }
44
45 if test "$IS_WIN32" = "yes"; then
46     pwd () {
47         command pwd -W "$@"
48     }
49 fi
50 ]
51 m4_divert_pop([PREPARE_TESTS])
52
53 m4_define([OVS_WAIT],
54   [AT_CHECK(
55      [ovs_wait_cond () { $1
56 }
57 ovs_wait], [0], [ignore], [ignore], [$2])])
58 m4_define([OVS_WAIT_UNTIL], [OVS_WAIT([$1], [$2])])
59 m4_define([OVS_WAIT_WHILE],
60   [OVS_WAIT([if $1; then return 1; else return 0; fi], [$2])])
61
62 dnl OVS_APP_EXIT_AND_WAIT(DAEMON)
63 dnl
64 dnl Ask the daemon named DAEMON to exit, via ovs-appctl, and then waits for it
65 dnl to exit.
66 m4_define([OVS_APP_EXIT_AND_WAIT],
67   [ovs-appctl -t $1 exit
68    OVS_WAIT_WHILE([test -e $1.pid])])
69
70 dnl ON_EXIT([COMMANDS])
71 dnl
72 dnl Adds the shell COMMANDS to a collection executed when the current test
73 dnl completes, as a cleanup action.  (The most common use is to kill a
74 dnl daemon started by the test.  This is important to prevent tests that
75 dnl start daemons from hanging at exit.)
76 m4_define([ON_EXIT], [trap '. ./cleanup' 0; cat >>cleanup <<'EOF'
77 $1
78 EOF
79 ])
80
81 m4_include([tests/ovsdb-macros.at])
82 m4_include([tests/ofproto-macros.at])
83
84 m4_include([tests/bfd.at])
85 m4_include([tests/cfm.at])
86 m4_include([tests/lacp.at])
87 m4_include([tests/library.at])
88 m4_include([tests/heap.at])
89 m4_include([tests/bundle.at])
90 m4_include([tests/classifier.at])
91 m4_include([tests/check-structs.at])
92 m4_include([tests/daemon.at])
93 m4_include([tests/daemon-py.at])
94 m4_include([tests/ofp-actions.at])
95 m4_include([tests/ofp-print.at])
96 m4_include([tests/ofp-util.at])
97 m4_include([tests/ofp-errors.at])
98 m4_include([tests/ovs-ofctl.at])
99 m4_include([tests/odp.at])
100 m4_include([tests/multipath.at])
101 m4_include([tests/learn.at])
102 m4_include([tests/vconn.at])
103 m4_include([tests/file_name.at])
104 m4_include([tests/aes128.at])
105 m4_include([tests/unixctl-py.at])
106 m4_include([tests/uuid.at])
107 m4_include([tests/json.at])
108 m4_include([tests/jsonrpc.at])
109 m4_include([tests/jsonrpc-py.at])
110 m4_include([tests/tunnel.at])
111 m4_include([tests/lockfile.at])
112 m4_include([tests/reconnect.at])
113 m4_include([tests/ovs-vswitchd.at])
114 m4_include([tests/ofproto.at])
115 m4_include([tests/ofproto-dpif.at])
116 m4_include([tests/vlan-splinters.at])
117 m4_include([tests/ovsdb.at])
118 m4_include([tests/ovs-vsctl.at])
119 m4_include([tests/ovs-monitor-ipsec.at])
120 m4_include([tests/ovs-xapi-sync.at])
121 m4_include([tests/interface-reconfigure.at])
122 m4_include([tests/stp.at])
123 m4_include([tests/vlog.at])
124 m4_include([tests/vtep-ctl.at])