Mon Dec 27 05:27:34 2010 UTC ()
Since atf_check doesn't deal with a pipeline, modify the tests to pipe
the output of the echo commands to atf_check itself.  This fixes the
three new ssp failures.

Note that the raw, strcpy, vsprintf, and vsnprintf tests still fail, but
they failed in the old 'regress' style, too.


(pgoyette)
diff -r1.1 -r1.2 src/tests/lib/libc/ssp/t_ssp.sh

cvs diff -r1.1 -r1.2 src/tests/lib/libc/ssp/t_ssp.sh (expand / switch to unified diff)

--- src/tests/lib/libc/ssp/t_ssp.sh 2010/12/27 02:04:19 1.1
+++ src/tests/lib/libc/ssp/t_ssp.sh 2010/12/27 05:27:34 1.2
@@ -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
28h_pass() 28h_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
34h_fail() 34h_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
40atf_test_case raw 40atf_test_case raw
41raw_head() 41raw_head()
42{ 42{
43 atf_set "descr" "Checks basic stack protection" 43 atf_set "descr" "Checks basic stack protection"
44} 44}
45raw_body() 45raw_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
105atf_test_case gets 105atf_test_case gets
106gets_head() 106gets_head()
107{ 107{
108 atf_set "descr" "Checks gets(3)" 108 atf_set "descr" "Checks gets(3)"
109} 109}
110gets_body() 110gets_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
118atf_test_case fgets 118atf_test_case fgets
119fgets_head() 119fgets_head()
120{ 120{
121 atf_set "descr" "Checks fgets(3)" 121 atf_set "descr" "Checks fgets(3)"
122} 122}
123fgets_body() 123fgets_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
131atf_test_case memcpy 131atf_test_case memcpy
132memcpy_head() 132memcpy_head()
133{ 133{
134 atf_set "descr" "Checks memcpy(3)" 134 atf_set "descr" "Checks memcpy(3)"
135} 135}
136memcpy_body() 136memcpy_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
222atf_test_case read 222atf_test_case read
223read_head() 223read_head()
224{ 224{
225 atf_set "descr" "Checks read(2)" 225 atf_set "descr" "Checks read(2)"
226} 226}
227read_body() 227read_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
235atf_test_case readlink 235atf_test_case readlink
236readlink_head() 236readlink_head()
237{ 237{
238 atf_set "descr" "Checks readlink(2)" 238 atf_set "descr" "Checks readlink(2)"
239} 239}
240readlink_body() 240readlink_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"