| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: t_ssp.sh,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ | | 1 | # $NetBSD: t_ssp.sh,v 1.2 2010/12/27 05:27:34 pgoyette Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2008 The NetBSD Foundation, Inc. | | 3 | # Copyright (c) 2008 The NetBSD Foundation, Inc. |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # Redistribution and use in source and binary forms, with or without | | 6 | # Redistribution and use in source and binary forms, with or without |
7 | # modification, are permitted provided that the following conditions | | 7 | # modification, are permitted provided that the following conditions |
8 | # are met: | | 8 | # are met: |
9 | # 1. Redistributions of source code must retain the above copyright | | 9 | # 1. Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. | | 10 | # notice, this list of conditions and the following disclaimer. |
11 | # 2. Redistributions in binary form must reproduce the above copyright | | 11 | # 2. Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the | | 12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. | | 13 | # documentation and/or other materials provided with the distribution. |
14 | # | | 14 | # |
| @@ -17,34 +17,34 @@ | | | @@ -17,34 +17,34 @@ |
17 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 17 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
18 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 18 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
19 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 19 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 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 | | 22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 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 | | 24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 | # POSSIBILITY OF SUCH DAMAGE. | | 25 | # POSSIBILITY OF SUCH DAMAGE. |
26 | # | | 26 | # |
27 | | | 27 | |
28 | h_pass() | | 28 | h_pass() |
29 | { | | 29 | { |
30 | echo "Executing command [ $1 ]" | | 30 | echo "Executing command [ $2$1 ]" |
31 | atf_check -s exit:0 -o ignore -e ignore $1 | | 31 | eval $2 atf_check -s exit:0 -o ignore -e ignore $1 |
32 | } | | 32 | } |
33 | | | 33 | |
34 | h_fail() | | 34 | h_fail() |
35 | { | | 35 | { |
36 | echo "Executing command [ $1 ]" | | 36 | echo "Executing command [ $2$1 ]" |
37 | atf_check -s signal:6 -o ignore -e ignore $1 | | 37 | eval $2 atf_check -s signal:6 -o ignore -e ignore $1 |
38 | } | | 38 | } |
39 | | | 39 | |
40 | atf_test_case raw | | 40 | atf_test_case raw |
41 | raw_head() | | 41 | raw_head() |
42 | { | | 42 | { |
43 | atf_set "descr" "Checks basic stack protection" | | 43 | atf_set "descr" "Checks basic stack protection" |
44 | } | | 44 | } |
45 | raw_body() | | 45 | raw_body() |
46 | { | | 46 | { |
47 | prog="$(atf_get_srcdir)/h_raw" | | 47 | prog="$(atf_get_srcdir)/h_raw" |
48 | | | 48 | |
49 | h_pass "$prog 9" | | 49 | h_pass "$prog 9" |
50 | h_fail "$prog 10" | | 50 | h_fail "$prog 10" |
| @@ -101,41 +101,41 @@ vsnprintf_body() | | | @@ -101,41 +101,41 @@ vsnprintf_body() |
101 | h_pass "$prog 10" | | 101 | h_pass "$prog 10" |
102 | h_fail "$prog 11" | | 102 | h_fail "$prog 11" |
103 | } | | 103 | } |
104 | | | 104 | |
105 | atf_test_case gets | | 105 | atf_test_case gets |
106 | gets_head() | | 106 | gets_head() |
107 | { | | 107 | { |
108 | atf_set "descr" "Checks gets(3)" | | 108 | atf_set "descr" "Checks gets(3)" |
109 | } | | 109 | } |
110 | gets_body() | | 110 | gets_body() |
111 | { | | 111 | { |
112 | prog="$(atf_get_srcdir)/h_gets" | | 112 | prog="$(atf_get_srcdir)/h_gets" |
113 | | | 113 | |
114 | h_pass "echo ok | $prog" | | 114 | h_pass "$prog" "echo ok |" |
115 | h_fail "echo 0123456789 | $prog" | | 115 | h_fail "$prog" "echo 0123456789 |" |
116 | } | | 116 | } |
117 | | | 117 | |
118 | atf_test_case fgets | | 118 | atf_test_case fgets |
119 | fgets_head() | | 119 | fgets_head() |
120 | { | | 120 | { |
121 | atf_set "descr" "Checks fgets(3)" | | 121 | atf_set "descr" "Checks fgets(3)" |
122 | } | | 122 | } |
123 | fgets_body() | | 123 | fgets_body() |
124 | { | | 124 | { |
125 | prog="$(atf_get_srcdir)/h_fgets" | | 125 | prog="$(atf_get_srcdir)/h_fgets" |
126 | | | 126 | |
127 | h_pass "echo ok | $prog 10" | | 127 | h_pass "$prog 10" "echo ok |" |
128 | h_fail "echo busted | $prog 11" | | 128 | h_fail "$prog 11" "echo busted |" |
129 | } | | 129 | } |
130 | | | 130 | |
131 | atf_test_case memcpy | | 131 | atf_test_case memcpy |
132 | memcpy_head() | | 132 | memcpy_head() |
133 | { | | 133 | { |
134 | atf_set "descr" "Checks memcpy(3)" | | 134 | atf_set "descr" "Checks memcpy(3)" |
135 | } | | 135 | } |
136 | memcpy_body() | | 136 | memcpy_body() |
137 | { | | 137 | { |
138 | prog="$(atf_get_srcdir)/h_memcpy" | | 138 | prog="$(atf_get_srcdir)/h_memcpy" |
139 | | | 139 | |
140 | h_pass "$prog 10" | | 140 | h_pass "$prog 10" |
141 | h_fail "$prog 11" | | 141 | h_fail "$prog 11" |
| @@ -218,28 +218,28 @@ strncat_body() | | | @@ -218,28 +218,28 @@ strncat_body() |
218 | h_pass "$prog 8" | | 218 | h_pass "$prog 8" |
219 | h_fail "$prog 9" | | 219 | h_fail "$prog 9" |
220 | } | | 220 | } |
221 | | | 221 | |
222 | atf_test_case read | | 222 | atf_test_case read |
223 | read_head() | | 223 | read_head() |
224 | { | | 224 | { |
225 | atf_set "descr" "Checks read(2)" | | 225 | atf_set "descr" "Checks read(2)" |
226 | } | | 226 | } |
227 | read_body() | | 227 | read_body() |
228 | { | | 228 | { |
229 | prog="$(atf_get_srcdir)/h_read" | | 229 | prog="$(atf_get_srcdir)/h_read" |
230 | | | 230 | |
231 | h_pass "echo foo | $prog 1024" | | 231 | h_pass "$prog 1024" "echo foo |" |
232 | h_fail "echo bar | $prog 1025" | | 232 | h_fail "$prog 1025" "echo bar |" |
233 | } | | 233 | } |
234 | | | 234 | |
235 | atf_test_case readlink | | 235 | atf_test_case readlink |
236 | readlink_head() | | 236 | readlink_head() |
237 | { | | 237 | { |
238 | atf_set "descr" "Checks readlink(2)" | | 238 | atf_set "descr" "Checks readlink(2)" |
239 | } | | 239 | } |
240 | readlink_body() | | 240 | readlink_body() |
241 | { | | 241 | { |
242 | prog="$(atf_get_srcdir)/h_readlink" | | 242 | prog="$(atf_get_srcdir)/h_readlink" |
243 | | | 243 | |
244 | h_pass "$prog 1024" | | 244 | h_pass "$prog 1024" |
245 | h_fail "$prog 1025" | | 245 | h_fail "$prog 1025" |