etc/protocols - sync with NetBSD-8
[minix.git] / tests / lib / libc / ssp / t_ssp.sh
blob0514348fa5cf20820ce8597d2dae1172622f95da
1 # $NetBSD: t_ssp.sh,v 1.7 2014/04/06 19:28:59 christos Exp $
3 # Copyright (c) 2008 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 h_pass()
30 echo "Executing command [ $2$1 ]"
31 eval $2 atf_check -s exit:0 -o ignore -e ignore $1
34 h_fail()
36 echo "Executing command [ $2$1 ]"
37 eval $2 atf_check -s signal:6 -o ignore -e ignore $1
40 atf_test_case sprintf
41 sprintf_head()
43 atf_set "descr" "Checks sprintf(3)"
45 sprintf_body()
47 prog="$(atf_get_srcdir)/h_sprintf"
49 h_pass "$prog ok"
50 h_fail "$prog 0123456789"
53 atf_test_case vsprintf
54 vsprintf_head()
56 atf_set "descr" "Checks vsprintf(3)"
58 vsprintf_body()
60 prog="$(atf_get_srcdir)/h_vsprintf"
62 h_pass "$prog ok"
63 h_fail "$prog 0123456789"
66 atf_test_case snprintf
67 snprintf_head()
69 atf_set "descr" "Checks snprintf(3)"
71 snprintf_body()
73 prog="$(atf_get_srcdir)/h_snprintf"
75 h_pass "$prog 10"
76 h_fail "$prog 11"
79 atf_test_case vsnprintf
80 vsnprintf_head()
82 atf_set "descr" "Checks vsnprintf(3)"
84 vsnprintf_body()
86 prog="$(atf_get_srcdir)/h_vsnprintf"
88 h_pass "$prog 10"
89 h_fail "$prog 11"
92 atf_test_case gets
93 gets_head()
95 atf_set "descr" "Checks gets(3)"
97 gets_body()
99 prog="$(atf_get_srcdir)/h_gets"
101 h_pass "$prog" "echo ok |"
102 h_fail "$prog" "echo 0123456789 |"
105 atf_test_case fgets
106 fgets_head()
108 atf_set "descr" "Checks fgets(3)"
110 fgets_body()
112 prog="$(atf_get_srcdir)/h_fgets"
114 h_pass "$prog 10" "echo ok |"
115 h_fail "$prog 11" "echo busted |"
118 atf_test_case memcpy
119 memcpy_head()
121 atf_set "descr" "Checks memcpy(3)"
123 memcpy_body()
125 prog="$(atf_get_srcdir)/h_memcpy"
127 h_pass "$prog 10"
128 h_fail "$prog 11"
131 atf_test_case memmove
132 memmove_head()
134 atf_set "descr" "Checks memmove(3)"
136 memmove_body()
138 prog="$(atf_get_srcdir)/h_memmove"
140 h_pass "$prog 10"
141 h_fail "$prog 11"
144 atf_test_case memset
145 memset_head()
147 atf_set "descr" "Checks memset(3)"
149 memset_body()
151 prog="$(atf_get_srcdir)/h_memset"
153 h_pass "$prog 10"
154 h_fail "$prog 11"
157 atf_test_case strcpy
158 strcpy_head()
160 atf_set "descr" "Checks strcpy(3)"
162 strcpy_body()
164 prog="$(atf_get_srcdir)/h_strcpy"
166 h_pass "$prog 0123456"
167 h_fail "$prog 0123456789"
170 atf_test_case stpcpy
171 stpcpy_head()
173 atf_set "descr" "Checks stpcpy(3)"
175 stpcpy_body()
177 prog="$(atf_get_srcdir)/h_stpcpy"
179 h_pass "$prog 0123456"
180 h_fail "$prog 0123456789"
183 atf_test_case strcat
184 strcat_head()
186 atf_set "descr" "Checks strcat(3)"
188 strcat_body()
190 prog="$(atf_get_srcdir)/h_strcat"
192 h_pass "$prog 0123456"
193 h_fail "$prog 0123456789ABCDEF"
196 atf_test_case strncpy
197 strncpy_head()
199 atf_set "descr" "Checks strncpy(3)"
201 strncpy_body()
203 prog="$(atf_get_srcdir)/h_strncpy"
205 h_pass "$prog 10"
206 h_fail "$prog 11"
209 atf_test_case stpncpy
210 stpncpy_head()
212 atf_set "descr" "Checks stpncpy(3)"
214 stpncpy_body()
216 prog="$(atf_get_srcdir)/h_stpncpy"
218 h_pass "$prog 10"
219 h_fail "$prog 11"
222 atf_test_case strncat
223 strncat_head()
225 atf_set "descr" "Checks strncat(3)"
227 strncat_body()
229 prog="$(atf_get_srcdir)/h_strncat"
231 h_pass "$prog 8"
232 h_fail "$prog 9"
235 atf_test_case raw
236 raw_head()
238 atf_set "descr" "Checks raw array overflow"
240 raw_body()
242 prog="$(atf_get_srcdir)/h_raw"
244 h_pass "$prog 9"
245 h_fail "$prog 10"
248 atf_test_case read
249 read_head()
251 atf_set "descr" "Checks read(2)"
253 read_body()
255 prog="$(atf_get_srcdir)/h_read"
257 h_pass "$prog 1024" "echo foo |"
258 h_fail "$prog 1025" "echo bar |"
261 atf_test_case readlink
262 readlink_head()
264 atf_set "descr" "Checks readlink(2)"
266 readlink_body()
268 prog="$(atf_get_srcdir)/h_readlink"
270 h_pass "$prog 1024"
271 h_fail "$prog 1025"
274 atf_test_case getcwd
275 getcwd_head()
277 atf_set "descr" "Checks getcwd(3)"
279 getcwd_body()
281 prog="$(atf_get_srcdir)/h_getcwd"
283 h_pass "$prog 1024"
284 h_fail "$prog 1025"
287 atf_init_test_cases()
289 atf_add_test_case sprintf
290 atf_add_test_case vsprintf
291 atf_add_test_case snprintf
292 atf_add_test_case vsnprintf
293 atf_add_test_case gets
294 atf_add_test_case fgets
295 atf_add_test_case memcpy
296 atf_add_test_case memmove
297 atf_add_test_case memset
298 atf_add_test_case stpcpy
299 atf_add_test_case stpncpy
300 atf_add_test_case strcat
301 atf_add_test_case strcpy
302 atf_add_test_case strncat
303 atf_add_test_case strncpy
304 atf_add_test_case raw
305 atf_add_test_case read
306 atf_add_test_case readlink
307 atf_add_test_case getcwd