tools/llvm: Do not build with symbols
[minix3.git] / tests / lib / libc / ssp / t_ssp.sh
blob8b97809490a650ce3af20afeedb3488a9b0f79f0
1 # $NetBSD: t_ssp.sh,v 1.5 2011/06/12 21:12:46 plunky 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 strcat
171 strcat_head()
173 atf_set "descr" "Checks strcat(3)"
175 strcat_body()
177 prog="$(atf_get_srcdir)/h_strcat"
179 h_pass "$prog 0123456"
180 h_fail "$prog 012345678"
183 atf_test_case strncpy
184 strncpy_head()
186 atf_set "descr" "Checks strncpy(3)"
188 strncpy_body()
190 prog="$(atf_get_srcdir)/h_strncpy"
192 h_pass "$prog 10"
193 h_fail "$prog 11"
196 atf_test_case strncat
197 strncat_head()
199 atf_set "descr" "Checks strncat(3)"
201 strncat_body()
203 prog="$(atf_get_srcdir)/h_strncat"
205 h_pass "$prog 8"
206 h_fail "$prog 9"
209 atf_test_case raw
210 raw_head()
212 atf_set "descr" "Checks raw array overflow"
214 raw_body()
216 prog="$(atf_get_srcdir)/h_raw"
218 h_pass "$prog 9"
219 h_fail "$prog 10"
222 atf_test_case read
223 read_head()
225 atf_set "descr" "Checks read(2)"
227 read_body()
229 prog="$(atf_get_srcdir)/h_read"
231 h_pass "$prog 1024" "echo foo |"
232 h_fail "$prog 1025" "echo bar |"
235 atf_test_case readlink
236 readlink_head()
238 atf_set "descr" "Checks readlink(2)"
240 readlink_body()
242 prog="$(atf_get_srcdir)/h_readlink"
244 h_pass "$prog 1024"
245 h_fail "$prog 1025"
248 atf_test_case getcwd
249 getcwd_head()
251 atf_set "descr" "Checks getcwd(3)"
253 getcwd_body()
255 prog="$(atf_get_srcdir)/h_getcwd"
257 h_pass "$prog 1024"
258 h_fail "$prog 1025"
261 atf_init_test_cases()
263 atf_add_test_case sprintf
264 atf_add_test_case vsprintf
265 atf_add_test_case snprintf
266 atf_add_test_case vsnprintf
267 atf_add_test_case gets
268 atf_add_test_case fgets
269 atf_add_test_case memcpy
270 atf_add_test_case memmove
271 atf_add_test_case memset
272 atf_add_test_case strcat
273 atf_add_test_case strcpy
274 atf_add_test_case strncat
275 atf_add_test_case strncpy
276 atf_add_test_case raw
277 atf_add_test_case read
278 atf_add_test_case readlink
279 atf_add_test_case getcwd