Remove building with NOCRYPTO option
[minix.git] / tests / lib / libc / net / getaddrinfo / t_getaddrinfo.sh
blob94a3c0b2e52c80bd1058774293999db168ab43ae
1 # $NetBSD: t_getaddrinfo.sh,v 1.2 2011/06/15 07:54:32 jmmv Exp $
4 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, and 2002 WIDE Project.
5 # All rights reserved.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 # 3. Neither the name of the project nor the names of its contributors
16 # may be used to endorse or promote products derived from this software
17 # without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 # ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 # SUCH DAMAGE.
32 check_output()
34 if [ "$2" = "none" ] ; then
35 exp="${1}.exp"
36 elif [ "$2" = "hosts" ] ; then
37 # Determine if localhost has an IPv6 address or not
38 lcl=$( cat /etc/hosts | \
39 sed -e 's/#.*$//' -e 's/[ ][ ]*/ /g' | \
40 awk '/ localhost($| )/ {printf "%s ", $1}' )
41 if [ "${lcl%*::*}" = "${lcl}" ] ; then
42 exp="${1}_v4.exp"
43 else
44 exp="${1}_v4v6.exp"
46 elif [ "$2" = "ifconfig" ] ; then
47 lcl=$( ifconfig lo0 | grep inet6 )
48 if [ -n "${lcl}" ] ; then
49 exp="${1}_v4v6.exp"
50 else
51 exp="${1}_v4.exp"
53 else
54 atf_fail "Invalid family_match_type $2 requested."
57 cmp -s $(atf_get_srcdir)/data/${exp} out && return
58 diff -u $(atf_get_srcdir)/data/${exp} out && \
59 atf_fail "Actual output does not match expected output"
62 atf_test_case basic
63 basic_head()
65 atf_set "descr" "Testing basic ones"
67 basic_body()
69 TEST=$(atf_get_srcdir)/h_gai
71 ( $TEST ::1 http
72 $TEST 127.0.0.1 http
73 $TEST localhost http
74 $TEST ::1 tftp
75 $TEST 127.0.0.1 tftp
76 $TEST localhost tftp
77 $TEST ::1 echo
78 $TEST 127.0.0.1 echo
79 $TEST localhost echo ) > out 2>&1
81 check_output basics hosts
84 atf_test_case specific
85 specific_head()
87 atf_set "descr" "Testing specific address family"
89 specific_body()
91 TEST=$(atf_get_srcdir)/h_gai
93 ( $TEST -4 localhost http
94 $TEST -6 localhost http ) > out 2>&1
96 check_output spec_fam hosts
99 atf_test_case empty_hostname
100 empty_hostname_head()
102 atf_set "descr" "Testing empty hostname"
104 empty_hostname_body()
106 TEST=$(atf_get_srcdir)/h_gai
108 ( $TEST '' http
109 $TEST '' echo
110 $TEST '' tftp
111 $TEST '' 80
112 $TEST -P '' http
113 $TEST -P '' echo
114 $TEST -P '' tftp
115 $TEST -P '' 80
116 $TEST -S '' 80
117 $TEST -D '' 80 ) > out 2>&1
119 check_output no_host ifconfig
122 atf_test_case empty_servname
123 empty_servname_head()
125 atf_set "descr" "Testing empty service name"
127 empty_servname_body()
129 TEST=$(atf_get_srcdir)/h_gai
131 ( $TEST ::1 ''
132 $TEST 127.0.0.1 ''
133 $TEST localhost ''
134 $TEST '' '' ) > out 2>&1
136 check_output no_serv hosts
139 atf_test_case sock_raw
140 sock_raw_head()
142 atf_set "descr" "Testing raw socket"
144 sock_raw_body()
146 TEST=$(atf_get_srcdir)/h_gai
148 ( $TEST -R -p 0 localhost ''
149 $TEST -R -p 59 localhost ''
150 $TEST -R -p 59 localhost 80
151 $TEST -R -p 59 localhost www
152 $TEST -R -p 59 ::1 '' ) > out 2>&1
154 check_output sock_raw hosts
157 atf_test_case unsupported_family
158 unsupported_family_head()
160 atf_set "descr" "Testing unsupported family"
162 unsupported_family_body()
164 TEST=$(atf_get_srcdir)/h_gai
166 ( $TEST -f 99 localhost '' ) > out 2>&1
168 check_output unsup_fam none
171 atf_test_case scopeaddr
172 scopeaddr_head()
174 atf_set "descr" "Testing scoped address format"
176 scopeaddr_body()
178 TEST=$(atf_get_srcdir)/h_gai
180 ( $TEST fe80::1%lo0 http
181 # IF=`ifconfig -a | grep -v '^ ' | \
182 # sed -e 's/:.*//' | head -1 | awk '{print $1}'`
183 # $TEST fe80::1%$IF http
184 ) > out 2>&1
186 check_output scoped none
189 atf_init_test_cases()
191 atf_add_test_case basic
192 atf_add_test_case specific
193 atf_add_test_case empty_hostname
194 atf_add_test_case empty_servname
195 atf_add_test_case sock_raw
196 atf_add_test_case unsupported_family
197 atf_add_test_case scopeaddr