1 # $NetBSD: t_ssp.sh,v 1.7 2014/04/06 19:28:59 christos 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 ]"
39 eval $2 atf_check -s signal -o ignore -e ignore $1
42 eval $2 atf_check -s signal:6 -o ignore -e ignore $1
51 atf_set "descr" "Checks sprintf(3)"
55 prog="$(atf_get_srcdir)/h_sprintf"
60 h_fail "$prog 0123456789ab"
63 h_fail "$prog 0123456789"
69 atf_test_case vsprintf
72 atf_set "descr" "Checks vsprintf(3)"
76 prog="$(atf_get_srcdir)/h_vsprintf"
81 h_fail "$prog 0123456789ab"
84 h_fail "$prog 0123456789"
90 atf_test_case snprintf
93 atf_set "descr" "Checks snprintf(3)"
97 prog="$(atf_get_srcdir)/h_snprintf"
111 atf_test_case vsnprintf
114 atf_set "descr" "Checks vsnprintf(3)"
118 prog="$(atf_get_srcdir)/h_vsnprintf"
135 atf_set "descr" "Checks gets(3)"
139 prog="$(atf_get_srcdir)/h_gets"
141 h_pass "$prog" "echo ok |"
144 h_fail "$prog" "echo 0123456789ab |"
147 h_fail "$prog" "echo 0123456789 |"
156 atf_set "descr" "Checks fgets(3)"
160 prog="$(atf_get_srcdir)/h_fgets"
162 h_pass "$prog 10" "echo ok |"
165 h_fail "$prog 13" "echo 0123456789abc |"
168 h_fail "$prog 11" "echo busted |"
177 atf_set "descr" "Checks memcpy(3)"
181 prog="$(atf_get_srcdir)/h_memcpy"
195 atf_test_case memmove
198 atf_set "descr" "Checks memmove(3)"
202 prog="$(atf_get_srcdir)/h_memmove"
219 atf_set "descr" "Checks memset(3)"
223 prog="$(atf_get_srcdir)/h_memset"
240 atf_set "descr" "Checks strcpy(3)"
244 prog="$(atf_get_srcdir)/h_strcpy"
246 h_pass "$prog 0123456"
249 h_fail "$prog 0123456789ab"
252 h_fail "$prog 0123456789"
261 atf_set "descr" "Checks stpcpy(3)"
265 prog="$(atf_get_srcdir)/h_stpcpy"
267 h_pass "$prog 0123456"
270 h_fail "$prog 0123456789ab"
273 h_fail "$prog 0123456789"
282 atf_set "descr" "Checks strcat(3)"
286 prog="$(atf_get_srcdir)/h_strcat"
288 h_pass "$prog 0123456"
289 h_fail "$prog 0123456789ABCDEF"
292 atf_test_case strncpy
295 atf_set "descr" "Checks strncpy(3)"
299 prog="$(atf_get_srcdir)/h_strncpy"
313 atf_test_case stpncpy
316 atf_set "descr" "Checks stpncpy(3)"
320 prog="$(atf_get_srcdir)/h_stpncpy"
334 atf_test_case strncat
337 atf_set "descr" "Checks strncat(3)"
341 prog="$(atf_get_srcdir)/h_strncat"
358 atf_set "descr" "Checks raw array overflow"
362 prog="$(atf_get_srcdir)/h_raw"
379 atf_set "descr" "Checks read(2)"
383 prog="$(atf_get_srcdir)/h_read"
385 h_pass "$prog 1024" "echo foo |"
388 h_fail "$prog 1027" "echo bar |"
391 h_fail "$prog 1025" "echo bar |"
397 atf_test_case readlink
400 atf_set "descr" "Checks readlink(2)"
404 prog="$(atf_get_srcdir)/h_readlink"
422 atf_set "descr" "Checks getcwd(3)"
426 prog="$(atf_get_srcdir)/h_getcwd"
438 atf_init_test_cases()
440 atf_add_test_case sprintf
441 atf_add_test_case vsprintf
442 atf_add_test_case snprintf
443 atf_add_test_case vsnprintf
444 atf_add_test_case gets
445 atf_add_test_case fgets
446 atf_add_test_case memcpy
447 atf_add_test_case memmove
448 atf_add_test_case memset
449 atf_add_test_case stpcpy
450 atf_add_test_case stpncpy
451 atf_add_test_case strcat
452 atf_add_test_case strcpy
453 atf_add_test_case strncat
454 atf_add_test_case strncpy
455 atf_add_test_case raw
456 atf_add_test_case read
457 atf_add_test_case readlink
458 atf_add_test_case getcwd