Fri Nov 20 05:05:40 2015 UTC ()
Set timeout of ping to reduce execution time


(ozaki-r)
diff -r1.5 -r1.6 src/tests/net/if/t_ifconfig.sh

cvs diff -r1.5 -r1.6 src/tests/net/if/t_ifconfig.sh (expand / switch to unified diff)

--- src/tests/net/if/t_ifconfig.sh 2015/11/06 02:54:37 1.5
+++ src/tests/net/if/t_ifconfig.sh 2015/11/20 05:05:40 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: t_ifconfig.sh,v 1.5 2015/11/06 02:54:37 ozaki-r Exp $ 1# $NetBSD: t_ifconfig.sh,v 1.6 2015/11/20 05:05:40 ozaki-r Exp $
2# 2#
3# Copyright (c) 2015 The NetBSD Foundation, Inc. 3# Copyright (c) 2015 The NetBSD Foundation, Inc.
4# All rights reserved. 4# All rights reserved.
5# 5#
6# Redistribution and use in source and binary forms, with or without 6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions 7# modification, are permitted provided that the following conditions
8# are met: 8# are met:
9# 1. Redistributions of source code must retain the above copyright 9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer. 10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright 11# 2. Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the 12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution. 13# documentation and/or other materials provided with the distribution.
14# 14#
@@ -21,26 +21,28 @@ @@ -21,26 +21,28 @@
21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25# POSSIBILITY OF SUCH DAMAGE. 25# POSSIBILITY OF SUCH DAMAGE.
26# 26#
27 27
28RUMP_SERVER1=unix://./r1 28RUMP_SERVER1=unix://./r1
29RUMP_SERVER2=unix://./r2 29RUMP_SERVER2=unix://./r2
30 30
31RUMP_FLAGS=\ 31RUMP_FLAGS=\
32"-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif" 32"-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif"
33 33
 34TIMEOUT=3
 35
34atf_test_case create_destroy cleanup 36atf_test_case create_destroy cleanup
35create_destroy_head() 37create_destroy_head()
36{ 38{
37 39
38 atf_set "descr" "tests of ifconfig create and destroy" 40 atf_set "descr" "tests of ifconfig create and destroy"
39 atf_set "require.progs" "rump_server" 41 atf_set "require.progs" "rump_server"
40} 42}
41 43
42create_destroy_body() 44create_destroy_body()
43{ 45{
44 atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER1} 46 atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER1}
45 47
46 export RUMP_SERVER=${RUMP_SERVER1} 48 export RUMP_SERVER=${RUMP_SERVER1}
@@ -109,27 +111,27 @@ options_body() @@ -109,27 +111,27 @@ options_body()
109 # -h -v shows statistics in human readable format 111 # -h -v shows statistics in human readable format
110 atf_check -s exit:0 -o ignore rump.ifconfig -h -v lo0 112 atf_check -s exit:0 -o ignore rump.ifconfig -h -v lo0
111 # -L shows IPv6 lifetime 113 # -L shows IPv6 lifetime
112 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 fc00::2 \ 114 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 fc00::2 \
113 pltime 100 115 pltime 100
114 $DEBUG && rump.ifconfig -L shmif0 116 $DEBUG && rump.ifconfig -L shmif0
115 atf_check -s exit:0 -o match:'pltime' rump.ifconfig -L shmif0 117 atf_check -s exit:0 -o match:'pltime' rump.ifconfig -L shmif0
116 atf_check -s exit:0 -o match:'vltime' rump.ifconfig -L shmif0 118 atf_check -s exit:0 -o match:'vltime' rump.ifconfig -L shmif0
117 # -m shows all of the supported media (not supported in shmif) 119 # -m shows all of the supported media (not supported in shmif)
118 $DEBUG && rump.ifconfig -m shmif0 120 $DEBUG && rump.ifconfig -m shmif0
119 atf_check -s exit:0 -o ignore rump.ifconfig -m shmif0 121 atf_check -s exit:0 -o ignore rump.ifconfig -m shmif0
120 atf_check -s exit:0 -o match:'localhost' rump.ifconfig -N lo0 122 atf_check -s exit:0 -o match:'localhost' rump.ifconfig -N lo0
121 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0 123 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0
122 atf_check -s exit:0 -o ignore rump.ping -c 1 localhost 124 atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT localhost
123 # -z clears and shows statistics at that point 125 # -z clears and shows statistics at that point
124 atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -z lo0 126 atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -z lo0
125 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0 127 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0
126 128
127 # ifconfig -a [-bdhLNmsuvz] 129 # ifconfig -a [-bdhLNmsuvz]
128 # -a shows all interfaces in the system 130 # -a shows all interfaces in the system
129 $DEBUG && rump.ifconfig -a 131 $DEBUG && rump.ifconfig -a
130 atf_check -s exit:0 -o match:'shmif0' -o match:'lo0' rump.ifconfig -a 132 atf_check -s exit:0 -o match:'shmif0' -o match:'lo0' rump.ifconfig -a
131 # -a -b shows only broadcast interfaces 133 # -a -b shows only broadcast interfaces
132 atf_check -s exit:0 -o match:'shmif0' -o not-match:'lo0' rump.ifconfig -a -b 134 atf_check -s exit:0 -o match:'shmif0' -o not-match:'lo0' rump.ifconfig -a -b
133 # -a -d shows only down interfaces 135 # -a -d shows only down interfaces
134 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down 136 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down
135 atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -a -d 137 atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -a -d
@@ -139,27 +141,27 @@ options_body() @@ -139,27 +141,27 @@ options_body()
139 atf_check -s exit:0 -o match:'vltime' rump.ifconfig -a -L 141 atf_check -s exit:0 -o match:'vltime' rump.ifconfig -a -L
140 atf_check -s exit:0 -o match:'localhost' rump.ifconfig -a -N 142 atf_check -s exit:0 -o match:'localhost' rump.ifconfig -a -N
141 atf_check -s exit:0 -o ignore rump.ifconfig -a -m 143 atf_check -s exit:0 -o ignore rump.ifconfig -a -m
142 # -a -s shows only interfaces connected to a network 144 # -a -s shows only interfaces connected to a network
143 # (shmif is always connected) 145 # (shmif is always connected)
144 $DEBUG && rump.ifconfig -a -s 146 $DEBUG && rump.ifconfig -a -s
145 atf_check -s exit:0 -o ignore rump.ifconfig -a -s 147 atf_check -s exit:0 -o ignore rump.ifconfig -a -s
146 # -a -u shows only up interfaces 148 # -a -u shows only up interfaces
147 atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -a -u 149 atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -a -u
148 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down 150 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down
149 atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig -a -u 151 atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig -a -u
150 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up 152 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up
151 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v 153 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v
152 atf_check -s exit:0 -o ignore rump.ping -c 1 localhost 154 atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT localhost
153 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down 155 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down
154 atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -a -z 156 atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -a -z
155 atf_check -s exit:0 -o not-match:'2 packets' rump.ifconfig -a -v 157 atf_check -s exit:0 -o not-match:'2 packets' rump.ifconfig -a -v
156 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v 158 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v
157 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up 159 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up
158 160
159 # ifconfig -l [-bdsu] 161 # ifconfig -l [-bdsu]
160 # -l shows only inteface names 162 # -l shows only inteface names
161 atf_check -s exit:0 -o match:'lo0 shmif0' rump.ifconfig -l 163 atf_check -s exit:0 -o match:'lo0 shmif0' rump.ifconfig -l
162 atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l -b 164 atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l -b
163 atf_check -s exit:0 -o ignore rump.ifconfig -l -d 165 atf_check -s exit:0 -o ignore rump.ifconfig -l -d
164 atf_check -s exit:0 -o match:'lo0 shmif0' rump.ifconfig -l -s 166 atf_check -s exit:0 -o match:'lo0 shmif0' rump.ifconfig -l -s
165 atf_check -s exit:0 -o match:'lo0 shmif0' rump.ifconfig -l -u 167 atf_check -s exit:0 -o match:'lo0 shmif0' rump.ifconfig -l -u
@@ -210,29 +212,30 @@ parameters_body() @@ -210,29 +212,30 @@ parameters_body()
210 atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.2/24 212 atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.2/24
211 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.3/24 alias 213 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.3/24 alias
212 atf_check -s exit:0 rump.ifconfig shmif0 up 214 atf_check -s exit:0 rump.ifconfig shmif0 up
213 unset RUMP_SERVER 215 unset RUMP_SERVER
214 216
215 export RUMP_SERVER=${RUMP_SERVER1} 217 export RUMP_SERVER=${RUMP_SERVER1}
216 218
217 # active 219 # active
218 atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:01 active 220 atf_check -s exit:0 rump.ifconfig shmif0 link b2:a0:75:00:00:01 active
219 atf_check -s exit:0 -o match:'address:.b2:a0:75:00:00:01' \ 221 atf_check -s exit:0 -o match:'address:.b2:a0:75:00:00:01' \
220 rump.ifconfig shmif0 222 rump.ifconfig shmif0
221 # down, up 223 # down, up
222 atf_check -s exit:0 rump.ifconfig shmif0 down 224 atf_check -s exit:0 rump.ifconfig shmif0 down
223 atf_check -s ignore -o ignore -e match:'down' rump.ping -c 1 -n 192.168.0.2 225 atf_check -s ignore -o ignore -e match:'down' rump.ping -c 1 \
 226 -w $TIMEOUT -n 192.168.0.2
224 atf_check -s exit:0 rump.ifconfig shmif0 up 227 atf_check -s exit:0 rump.ifconfig shmif0 up
225 atf_check -s exit:0 -o ignore rump.ping -c 1 -n 192.168.0.2 228 atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT -n 192.168.0.2
226 229
227 # alias 230 # alias
228 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 alias 231 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 alias
229 atf_check -s exit:0 -o match:'alias 192.168.1.1' rump.ifconfig shmif0 232 atf_check -s exit:0 -o match:'alias 192.168.1.1' rump.ifconfig shmif0
230 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 -alias 233 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 -alias
231 atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0 234 atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0
232 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 235 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1
233 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 236 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2
234 atf_check -s exit:0 -o match:'fc00::1' rump.ifconfig shmif0 inet6 237 atf_check -s exit:0 -o match:'fc00::1' rump.ifconfig shmif0 inet6
235 atf_check -s exit:0 -o match:'fc00::2' rump.ifconfig shmif0 inet6 238 atf_check -s exit:0 -o match:'fc00::2' rump.ifconfig shmif0 inet6
236 239
237 # delete 240 # delete
238 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1 alias 241 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1 alias
@@ -240,27 +243,27 @@ parameters_body() @@ -240,27 +243,27 @@ parameters_body()
240 atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0 inet 243 atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0 inet
241 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1 delete 244 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1 delete
242 atf_check -s exit:0 -o not-match:'192.168.0.1' rump.ifconfig shmif0 inet 245 atf_check -s exit:0 -o not-match:'192.168.0.1' rump.ifconfig shmif0 inet
243 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 delete 246 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 delete
244 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 delete 247 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 delete
245 atf_check -s exit:0 -o not-match:'fc00::1' rump.ifconfig shmif0 inet6 248 atf_check -s exit:0 -o not-match:'fc00::1' rump.ifconfig shmif0 inet6
246 atf_check -s exit:0 -o not-match:'fc00::2' rump.ifconfig shmif0 inet6 249 atf_check -s exit:0 -o not-match:'fc00::2' rump.ifconfig shmif0 inet6
247 250
248 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1/24 251 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.0.1/24
249 252
250 # arp 253 # arp
251 atf_check -s exit:0 rump.ifconfig shmif0 -arp 254 atf_check -s exit:0 rump.ifconfig shmif0 -arp
252 atf_check -s not-exit:0 -o ignore -e ignore \ 255 atf_check -s not-exit:0 -o ignore -e ignore \
253 rump.ping -c 1 -n 192.168.0.3 256 rump.ping -c 1 -w $TIMEOUT -n 192.168.0.3
254 atf_check -s exit:0 -o not-match:'192.168.0.3' rump.arp -an 257 atf_check -s exit:0 -o not-match:'192.168.0.3' rump.arp -an
255 258
256 # netmask 259 # netmask
257 atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 netmask 255.255.255.0 alias 260 atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 netmask 255.255.255.0 alias
258 atf_check -s exit:0 -o match:'172.16.0/24' rump.netstat -rn -f inet 261 atf_check -s exit:0 -o match:'172.16.0/24' rump.netstat -rn -f inet
259 atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 delete 262 atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 delete
260 263
261 # broadcast (does it not work?) 264 # broadcast (does it not work?)
262 atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 \ 265 atf_check -s exit:0 rump.ifconfig shmif0 inet 172.16.0.1 \
263 broadcast 255.255.255.255 alias 266 broadcast 255.255.255.255 alias
264 atf_check -s exit:0 -o match:'broadcast 255.255.255.255' \ 267 atf_check -s exit:0 -o match:'broadcast 255.255.255.255' \
265 rump.ifconfig shmif0 inet 268 rump.ifconfig shmif0 inet
266 269