No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / atf / dist / tests / bootstrap / h_tp_atf_check_sh.sh
blobc5487ea5cb93e70cd9bf7e7fc37d4973827e4d77
2 # Automated Testing Framework (atf)
4 # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
5 # All rights reserved.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17 # CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 # IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 atf_test_case exitcode_0_0
31 exitcode_0_0_head()
33 atf_set "descr" "Runs a program that returns true and expects true"
35 exitcode_0_0_body()
37 atf_check -s eq:0 -o empty -e empty true
40 atf_test_case exitcode_0_1
41 exitcode_0_1_head()
43 atf_set "descr" "Runs a program that returns true and expects false"
45 exitcode_0_1_body()
47 atf_check -s eq:1 -o empty -e empty true
50 atf_test_case exitcode_1_0
51 exitcode_1_0_head()
53 atf_set "descr" "Runs a program that returns false and expects true"
55 exitcode_1_0_body()
57 atf_check -s eq:0 -o empty -e empty false
60 atf_test_case exitcode_1_1
61 exitcode_1_1_head()
63 atf_set "descr" "Runs a program that returns false and expects false"
65 exitcode_1_1_body()
67 # In Solaris, /usr/bin/false returns 255 rather than 1. Use the
68 # built-in version for the check.
69 atf_check -s eq:1 -o empty -e empty sh -c "false"
72 atf_test_case stdout_expout_pass
73 stdout_expout_pass_head()
75 atf_set "descr" "Runs a program with stdout set to expout and passes"
77 stdout_expout_pass_body()
79 echo foo >expout
80 atf_check -s eq:0 -o file:expout -e empty echo foo
83 atf_test_case stdout_expout_fail
84 stdout_expout_fail_head()
86 atf_set "descr" "Runs a program with stdout set to expout and fails"
88 stdout_expout_fail_body()
90 echo foo >expout
91 atf_check -s eq:0 -o file:expout -e empty echo bar
94 atf_test_case stdout_ignore_empty
95 stdout_ignore_empty_head()
97 atf_set "descr" "Runs a program with stdout set to ignore and" \
98 "writes nothing"
100 stdout_ignore_empty_body()
102 atf_check -s eq:0 -o ignore -e empty true
105 atf_test_case stdout_ignore_sth
106 stdout_ignore_sth_head()
108 atf_set "descr" "Runs a program with stdout set to ignore and" \
109 "writes something"
111 stdout_ignore_sth_body()
113 atf_check -s eq:0 -o ignore -e empty echo foo
116 atf_test_case stdout_null_empty
117 stdout_null_empty_head()
119 atf_set "descr" "Runs a program with stdout set to null and" \
120 "writes nothing"
122 stdout_null_empty_body()
124 atf_check -s eq:0 -o empty -e empty true
127 atf_test_case stdout_null_sth
128 stdout_null_sth_head()
130 atf_set "descr" "Runs a program with stdout set to null and" \
131 "writes something"
133 stdout_null_sth_body()
135 atf_check -s eq:0 -o empty -e empty echo foo
138 atf_test_case stdout_stdout_written
139 stdout_stdout_written_head()
141 atf_set "descr" "Runs a program with stdout set to stdout and" \
142 "writes something"
144 stdout_stdout_written_body()
146 atf_check -s eq:0 -o save:stdout -e empty echo foo
147 echo foo >aux
148 cmp -s stdout aux || atf_fail "Test failed"
151 atf_test_case stderr_experr_pass
152 stderr_experr_pass_head()
154 atf_set "descr" "Runs a program with stderr set to experr and passes"
156 stderr_experr_pass_body()
158 echo foo >experr
159 atf_check -s eq:0 -o empty -e file:experr -x 'echo foo 1>&2'
162 atf_test_case stderr_experr_fail
163 stderr_experr_fail_head()
165 atf_set "descr" "Runs a program with stderr set to experr and fails"
167 stderr_experr_fail_body()
169 echo foo >experr
170 atf_check -s eq:0 -o empty -e file:stderr -x 'echo bar 1>&2'
173 atf_test_case stderr_ignore_empty
174 stderr_ignore_empty_head()
176 atf_set "descr" "Runs a program with stderr set to ignore and" \
177 "writes nothing"
179 stderr_ignore_empty_body()
181 atf_check -s eq:0 -o empty -e ignore -x 'true 1>&2'
184 atf_test_case stderr_ignore_sth
185 stderr_ignore_sth_head()
187 atf_set "descr" "Runs a program with stderr set to ignore and" \
188 "writes something"
190 stderr_ignore_sth_body()
192 atf_check -s eq:0 -o empty -e ignore -x 'echo foo 1>&2'
195 atf_test_case stderr_null_empty
196 stderr_null_empty_head()
198 atf_set "descr" "Runs a program with stderr set to null and" \
199 "writes nothing"
201 stderr_null_empty_body()
203 atf_check -s eq:0 -o empty -e empty -x 'true 1>&2'
206 atf_test_case stderr_null_sth
207 stderr_null_sth_head()
209 atf_set "descr" "Runs a program with stderr set to null and" \
210 "writes something"
212 stderr_null_sth_body()
214 atf_check -s eq:0 -o empty -e empty -x 'echo foo 1>&2'
217 atf_test_case stderr_stderr_written
218 stderr_stderr_written_head()
220 atf_set "descr" "Runs a program with stderr set to stderr and" \
221 "writes something"
223 stderr_stderr_written_body()
225 atf_check -s eq:0 -o empty -e save:stderr -x 'echo foo 1>&2'
226 echo foo >aux
227 cmp -s stderr aux || atf_fail "Test failed"
230 atf_init_test_cases()
232 atf_add_test_case exitcode_0_0
233 atf_add_test_case exitcode_0_1
234 atf_add_test_case exitcode_1_0
235 atf_add_test_case exitcode_1_1
237 atf_add_test_case stdout_expout_pass
238 atf_add_test_case stdout_expout_fail
239 atf_add_test_case stdout_ignore_empty
240 atf_add_test_case stdout_ignore_sth
241 atf_add_test_case stdout_null_empty
242 atf_add_test_case stdout_null_sth
243 atf_add_test_case stdout_stdout_written
245 atf_add_test_case stderr_experr_pass
246 atf_add_test_case stderr_experr_fail
247 atf_add_test_case stderr_ignore_empty
248 atf_add_test_case stderr_ignore_sth
249 atf_add_test_case stderr_null_empty
250 atf_add_test_case stderr_null_sth
251 atf_add_test_case stderr_stderr_written
254 # vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4