1 # $NetBSD: t_ssp.sh,v 1.5 2011/06/12 21:12:46 plunky Exp $
3 # Copyright (c) 2008 The NetBSD Foundation, Inc.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
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.
30 echo "Executing command [ $2$1 ]"
31 eval $2 atf_check
-s exit:0 -o ignore
-e ignore
$1
36 echo "Executing command [ $2$1 ]"
37 eval $2 atf_check
-s signal
:6 -o ignore
-e ignore
$1
43 atf_set
"descr" "Checks sprintf(3)"
47 prog
="$(atf_get_srcdir)/h_sprintf"
50 h_fail
"$prog 0123456789"
53 atf_test_case vsprintf
56 atf_set
"descr" "Checks vsprintf(3)"
60 prog
="$(atf_get_srcdir)/h_vsprintf"
63 h_fail
"$prog 0123456789"
66 atf_test_case snprintf
69 atf_set
"descr" "Checks snprintf(3)"
73 prog
="$(atf_get_srcdir)/h_snprintf"
79 atf_test_case vsnprintf
82 atf_set
"descr" "Checks vsnprintf(3)"
86 prog
="$(atf_get_srcdir)/h_vsnprintf"
95 atf_set
"descr" "Checks gets(3)"
99 prog
="$(atf_get_srcdir)/h_gets"
101 h_pass
"$prog" "echo ok |"
102 h_fail
"$prog" "echo 0123456789 |"
108 atf_set
"descr" "Checks fgets(3)"
112 prog
="$(atf_get_srcdir)/h_fgets"
114 h_pass
"$prog 10" "echo ok |"
115 h_fail
"$prog 11" "echo busted |"
121 atf_set
"descr" "Checks memcpy(3)"
125 prog
="$(atf_get_srcdir)/h_memcpy"
131 atf_test_case memmove
134 atf_set
"descr" "Checks memmove(3)"
138 prog
="$(atf_get_srcdir)/h_memmove"
147 atf_set
"descr" "Checks memset(3)"
151 prog
="$(atf_get_srcdir)/h_memset"
160 atf_set
"descr" "Checks strcpy(3)"
164 prog
="$(atf_get_srcdir)/h_strcpy"
166 h_pass
"$prog 0123456"
167 h_fail
"$prog 0123456789"
173 atf_set
"descr" "Checks strcat(3)"
177 prog
="$(atf_get_srcdir)/h_strcat"
179 h_pass
"$prog 0123456"
180 h_fail
"$prog 012345678"
183 atf_test_case strncpy
186 atf_set
"descr" "Checks strncpy(3)"
190 prog
="$(atf_get_srcdir)/h_strncpy"
196 atf_test_case strncat
199 atf_set
"descr" "Checks strncat(3)"
203 prog
="$(atf_get_srcdir)/h_strncat"
212 atf_set
"descr" "Checks raw array overflow"
216 prog
="$(atf_get_srcdir)/h_raw"
225 atf_set
"descr" "Checks read(2)"
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
238 atf_set
"descr" "Checks readlink(2)"
242 prog
="$(atf_get_srcdir)/h_readlink"
251 atf_set
"descr" "Checks getcwd(3)"
255 prog
="$(atf_get_srcdir)/h_getcwd"
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