2 dnl Automated Testing Framework (atf)
4 dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
5 dnl All rights reserved.
7 dnl Redistribution and use in source and binary forms, with or without
8 dnl modification, are permitted provided that the following conditions
10 dnl 1. Redistributions of source code must retain the above copyright
11 dnl notice, this list of conditions and the following disclaimer.
12 dnl 2. Redistributions in binary form must reproduce the above copyright
13 dnl notice, this list of conditions and the following disclaimer in the
14 dnl documentation and/or other materials provided with the distribution.
16 dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17 dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21 dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 AT_SETUP([test_program: compare the user-visible interfaces])
33 AT_CHECK([TEST_HELPER(tp_basic_c)], [1], [], [stderr])
34 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
35 AT_CHECK([TEST_HELPER(tp_basic_cpp)], [1], [], [experr])
36 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
37 AT_CHECK([TEST_HELPER(tp_basic_sh)], [1], [], [experr])
39 dnl Try to ask for help, which is not bundled in.
40 AT_CHECK([TEST_HELPER(tp_basic_c) -h], [1], [], [stderr])
41 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
42 AT_CHECK([TEST_HELPER(tp_basic_cpp) -h], [1], [], [experr])
43 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
44 AT_CHECK([TEST_HELPER(tp_basic_sh) -h], [1], [], [experr])
46 dnl Give an invalid option.
47 AT_CHECK([TEST_HELPER(tp_basic_c) -Z], [1], [], [stderr])
48 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
49 AT_CHECK([TEST_HELPER(tp_basic_cpp) -Z], [1], [], [experr])
50 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
51 AT_CHECK([TEST_HELPER(tp_basic_sh) -Z], [1], [], [experr])
54 AT_CHECK([TEST_HELPER(tp_basic_c) -l], [0], [stdout], [])
55 sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
56 AT_CHECK([TEST_HELPER(tp_basic_cpp) -l], [0], [expout], [])
57 sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
58 AT_CHECK([TEST_HELPER(tp_basic_sh) -l], [0], [expout], [])
61 AT_CHECK([TEST_HELPER(tp_basic_c)],
62 [1], [stdout], [stderr])
63 sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
64 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
65 AT_CHECK([TEST_HELPER(tp_basic_cpp)],
66 [1], [expout], [experr])
67 sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
68 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
69 AT_CHECK([TEST_HELPER(tp_basic_sh)],
70 [1], [expout], [experr])
72 dnl Run the pass test case.
73 AT_CHECK([TEST_HELPER(tp_basic_c) -r resout pass],
74 [0], [stdout], [stderr])
75 sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
76 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
77 sed 's,tp_basic_c,tp_basic_cpp,g' <resout >resexp
78 AT_CHECK([TEST_HELPER(tp_basic_cpp) -r resout pass],
79 [0], [expout], [experr])
80 AT_CHECK([cmp -s resout resexp], [0], [], [])
81 sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
82 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
83 sed 's,tp_basic_c,tp_basic_sh,g' <resout >resexp
84 AT_CHECK([TEST_HELPER(tp_basic_sh) -r resout pass],
85 [0], [expout], [experr])
86 AT_CHECK([cmp -s resout resexp], [0], [], [])
88 dnl Run the fail test case.
89 AT_CHECK([TEST_HELPER(tp_basic_c) -r resout fail],
90 [1], [stdout], [stderr])
91 sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
92 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
93 sed 's,tp_basic_c,tp_basic_cpp,g' <resout >resexp
94 AT_CHECK([TEST_HELPER(tp_basic_cpp) -r resout fail],
95 [1], [expout], [experr])
96 AT_CHECK([cmp -s resout resexp], [0], [], [])
97 sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
98 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
99 sed 's,tp_basic_c,tp_basic_sh,g' <resout >resexp
100 AT_CHECK([TEST_HELPER(tp_basic_sh) -r resout fail],
101 [1], [expout], [experr])
102 AT_CHECK([cmp -s resout resexp], [0], [], [])
104 dnl Run the skip test case.
105 AT_CHECK([TEST_HELPER(tp_basic_c) -r resout skip],
106 [0], [stdout], [stderr])
107 sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
108 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
109 sed 's,tp_basic_c,tp_basic_cpp,g' <resout >resexp
110 AT_CHECK([TEST_HELPER(tp_basic_cpp) -r resout skip],
111 [0], [expout], [experr])
112 AT_CHECK([cmp -s resout resexp], [0], [], [])
113 sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
114 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
115 sed 's,tp_basic_c,tp_basic_sh,g' <resout >resexp
116 AT_CHECK([TEST_HELPER(tp_basic_sh) -r resout skip],
117 [0], [expout], [experr])
118 AT_CHECK([cmp -s resout resexp], [0], [], [])
120 dnl Run the default test case.
121 AT_CHECK([TEST_HELPER(tp_basic_c) -r resout default],
122 [0], [stdout], [stderr])
123 sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
124 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
125 sed 's,tp_basic_c,tp_basic_cpp,g' <resout >resexp
126 AT_CHECK([TEST_HELPER(tp_basic_cpp) -r resout default],
127 [0], [expout], [experr])
128 AT_CHECK([cmp -s resout resexp], [0], [], [])
129 sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
130 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
131 sed 's,tp_basic_c,tp_basic_sh,g' <resout >resexp
132 AT_CHECK([TEST_HELPER(tp_basic_sh) -r resout default],
133 [0], [expout], [experr])
134 AT_CHECK([cmp -s resout resexp], [0], [], [])
136 dnl Try running multiple tests.
137 AT_CHECK([TEST_HELPER(tp_basic_c) pass fail],
138 [1], [stdout], [stderr])
139 sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
140 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
141 AT_CHECK([TEST_HELPER(tp_basic_cpp) pass fail],
142 [1], [expout], [experr])
143 sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
144 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
145 AT_CHECK([TEST_HELPER(tp_basic_sh) pass fail],
146 [1], [expout], [experr])
148 dnl Run an unknown test case.
149 AT_CHECK([TEST_HELPER(tp_basic_c) unknown],
150 [1], [stdout], [stderr])
151 sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
152 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
153 AT_CHECK([TEST_HELPER(tp_basic_cpp) unknown],
154 [1], [expout], [experr])
155 sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
156 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
157 AT_CHECK([TEST_HELPER(tp_basic_sh) unknown],
158 [1], [expout], [experr])
160 dnl Try running a non-existent cleanup routine.
161 AT_CHECK([TEST_HELPER(tp_basic_c) pass:cleanup],
162 [0], [stdout], [stderr])
163 sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
164 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
165 AT_CHECK([TEST_HELPER(tp_basic_cpp) pass:cleanup],
166 [0], [expout], [experr])
167 sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
168 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
169 AT_CHECK([TEST_HELPER(tp_basic_sh) pass:cleanup],
170 [0], [expout], [experr])
172 dnl Run a test and dump the results on stdout.
173 AT_CHECK([TEST_HELPER(tp_basic_c) skip],
174 [0], [stdout], [stderr])
175 sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
176 sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
177 AT_CHECK([TEST_HELPER(tp_basic_cpp) skip],
178 [0], [expout], [experr])
179 sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
180 sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
181 AT_CHECK([TEST_HELPER(tp_basic_sh) skip],
182 [0], [expout], [experr])
186 dnl vim: syntax=m4:expandtab:shiftwidth=4:softtabstop=4