Import NetBSD's passwd.conf
[minix3.git] / tests / net / if / t_ifconfig.sh
blob30644bf4cb13cf39ba97c0d6890965e434cff09b
1 # $NetBSD: t_ifconfig.sh,v 1.3 2015/09/15 09:51:01 ozaki-r Exp $
3 # Copyright (c) 2015 The NetBSD Foundation, Inc.
4 # All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
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
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
25 # POSSIBILITY OF SUCH DAMAGE.
28 RUMP_SERVER1=unix://./r1
30 RUMP_FLAGS=\
31 "-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif"
33 atf_test_case create_destroy cleanup
34 create_destroy_head()
37 atf_set "descr" "tests of ifconfig create and destroy"
38 atf_set "require.progs" "rump_server"
41 create_destroy_body()
43 atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${RUMP_SERVER1}
45 export RUMP_SERVER=${RUMP_SERVER1}
47 # Create and destroy (no address)
48 atf_check -s exit:0 rump.ifconfig shmif0 create
49 atf_check -s exit:0 rump.ifconfig shmif0 destroy
51 # Create and destroy (with an IPv4 address)
52 atf_check -s exit:0 rump.ifconfig shmif0 create
53 atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus
54 atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1/24
55 atf_check -s exit:0 rump.ifconfig shmif0 up
56 atf_check -s exit:0 rump.ifconfig shmif0 destroy
58 # Create and destroy (with an IPv6 address)
59 atf_check -s exit:0 rump.ifconfig shmif0 create
60 atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus
61 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1
62 atf_check -s exit:0 rump.ifconfig shmif0 up
63 atf_check -s exit:0 rump.ifconfig shmif0 destroy
65 unset RUMP_SERVER
68 create_destroy_cleanup()
71 RUMP_SERVER=${RUMP_SERVER1} rump.halt
74 atf_test_case options cleanup
75 options_head()
78 atf_set "descr" "tests of ifconfig options"
79 atf_set "require.progs" "rump_server"
82 options_body()
85 export RUMP_SERVER=${RUMP_SERVER1}
86 atf_check -s exit:0 rump_server $RUMP_FLAGS $RUMP_SERVER1
88 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create
89 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr bus1
90 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet 10.0.0.1/24
91 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 fc00::1/64
92 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up
93 atf_check -s exit:0 -o ignore rump.ifconfig -w 10
94 $DEBUG && rump.ifconfig shmif0
96 # ifconfig [-N] interface address_family
97 # -N resolves hostnames
98 atf_check -s exit:0 -o match:'inet 127.0.0.1' rump.ifconfig lo0 inet
99 atf_check -s exit:0 -o match:'inet localhost' rump.ifconfig -N lo0 inet
100 atf_check -s exit:0 -o match:'inet6 ::1' rump.ifconfig lo0 inet6
101 atf_check -s exit:0 -o match:'inet6 localhost' rump.ifconfig -N lo0 inet6
102 atf_check -s not-exit:0 -e match:'not supported' rump.ifconfig lo0 atalk
103 atf_check -s not-exit:0 -e match:'not supported' rump.ifconfig -N lo0 atalk
104 atf_check -s exit:0 -o ignore rump.ifconfig lo0 link
105 atf_check -s exit:0 -o ignore rump.ifconfig -N lo0 link
107 # ifconfig [-hLmNvz] interface
108 # -h -v shows statistics in human readable format
109 atf_check -s exit:0 -o ignore rump.ifconfig -h -v lo0
110 # -L shows IPv6 lifetime
111 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 fc00::2 \
112 pltime 100
113 $DEBUG && rump.ifconfig -L shmif0
114 atf_check -s exit:0 -o match:'pltime' rump.ifconfig -L shmif0
115 atf_check -s exit:0 -o match:'vltime' rump.ifconfig -L shmif0
116 # -m shows all of the supported media (not supported in shmif)
117 $DEBUG && rump.ifconfig -m shmif0
118 atf_check -s exit:0 -o ignore rump.ifconfig -m shmif0
119 atf_check -s exit:0 -o match:'localhost' rump.ifconfig -N lo0
120 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0
121 atf_check -s exit:0 -o ignore rump.ping -c 1 localhost
122 # -z clears and shows statistics at that point
123 atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -z lo0
124 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0
126 # ifconfig -a [-bdhLNmsuvz]
127 # -a shows all interfaces in the system
128 $DEBUG && rump.ifconfig -a
129 atf_check -s exit:0 -o match:'shmif0' -o match:'lo0' rump.ifconfig -a
130 # -a -b shows only broadcast interfaces
131 atf_check -s exit:0 -o match:'shmif0' -o not-match:'lo0' rump.ifconfig -a -b
132 # -a -d shows only down interfaces
133 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down
134 atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -a -d
135 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up
136 atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig -a -d
137 atf_check -s exit:0 -o match:'pltime' rump.ifconfig -a -L
138 atf_check -s exit:0 -o match:'vltime' rump.ifconfig -a -L
139 atf_check -s exit:0 -o match:'localhost' rump.ifconfig -a -N
140 atf_check -s exit:0 -o ignore rump.ifconfig -a -m
141 # -a -s shows only interfaces connected to a network
142 # (shmif is always connected)
143 $DEBUG && rump.ifconfig -a -s
144 atf_check -s exit:0 -o ignore rump.ifconfig -a -s
145 # -a -u shows only up interfaces
146 atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -a -u
147 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down
148 atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig -a -u
149 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up
150 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v
151 atf_check -s exit:0 -o ignore rump.ping -c 1 localhost
152 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down
153 atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -a -z
154 atf_check -s exit:0 -o not-match:'2 packets' rump.ifconfig -a -v
155 atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v
156 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up
158 # ifconfig -l [-bdsu]
159 # -l shows only inteface names
160 atf_check -s exit:0 -o match:'lo0 shmif0' rump.ifconfig -l
161 atf_check -s exit:0 -o match:'shmif0' rump.ifconfig -l -b
162 atf_check -s exit:0 -o ignore rump.ifconfig -l -d
163 atf_check -s exit:0 -o match:'lo0 shmif0' rump.ifconfig -l -s
164 atf_check -s exit:0 -o match:'lo0 shmif0' rump.ifconfig -l -u
166 # ifconfig -s interface
167 # -s interface exists with 0 / 1 if connected / disconnected
168 atf_check -s exit:0 -o empty rump.ifconfig -s lo0
169 atf_check -s exit:0 -o empty rump.ifconfig -s shmif0
171 # ifconfig -C
172 # -C shows all of the interface cloners available on the system
173 atf_check -s exit:0 -o match:'shmif lo carp' rump.ifconfig -C
175 unset RUMP_SERVER
178 options_cleanup()
181 env RUMP_SERVER=${RUMP_SERVER1} rump.halt
184 atf_init_test_cases()
187 atf_add_test_case create_destroy
188 atf_add_test_case options