summaryrefslogtreecommitdiff
path: root/unit/atf-src/bootstrap/t_test_program_compare.at
blob: fe7643460461486d086ef77179d2823e26620e28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
dnl
dnl Automated Testing Framework (atf)
dnl
dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
dnl All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions
dnl are met:
dnl 1. Redistributions of source code must retain the above copyright
dnl    notice, this list of conditions and the following disclaimer.
dnl 2. Redistributions in binary form must reproduce the above copyright
dnl    notice, this list of conditions and the following disclaimer in the
dnl    documentation and/or other materials provided with the distribution.
dnl
dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dnl

AT_SETUP([test_program: compare the user-visible interfaces])

dnl No arguments.
AT_CHECK([TEST_HELPER(tp_basic_c)], [1], [], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_cpp)], [1], [], [experr])
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_sh)], [1], [], [experr])

dnl Try to ask for help, which is not bundled in.
AT_CHECK([TEST_HELPER(tp_basic_c) -h], [1], [], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_cpp) -h], [1], [], [experr])
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_sh) -h], [1], [], [experr])

dnl Give an invalid option.
AT_CHECK([TEST_HELPER(tp_basic_c) -Z], [1], [], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_cpp) -Z], [1], [], [experr])
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_sh) -Z], [1], [], [experr])

dnl List all tests.
AT_CHECK([TEST_HELPER(tp_basic_c) -l], [0], [stdout], [])
sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
AT_CHECK([TEST_HELPER(tp_basic_cpp) -l], [0], [expout], [])
sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
AT_CHECK([TEST_HELPER(tp_basic_sh) -l], [0], [expout], [])

dnl Run no tests.
AT_CHECK([TEST_HELPER(tp_basic_c)],
         [1], [stdout], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_cpp)],
         [1], [expout], [experr])
sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_sh)],
         [1], [expout], [experr])

dnl Run the pass test case.
AT_CHECK([TEST_HELPER(tp_basic_c) -r resout pass],
         [0], [stdout], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
sed 's,tp_basic_c,tp_basic_cpp,g' <resout >resexp
AT_CHECK([TEST_HELPER(tp_basic_cpp) -r resout pass],
         [0], [expout], [experr])
AT_CHECK([cmp -s resout resexp], [0], [], [])
sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
sed 's,tp_basic_c,tp_basic_sh,g' <resout >resexp
AT_CHECK([TEST_HELPER(tp_basic_sh) -r resout pass],
         [0], [expout], [experr])
AT_CHECK([cmp -s resout resexp], [0], [], [])

dnl Run the fail test case.
AT_CHECK([TEST_HELPER(tp_basic_c) -r resout fail],
         [1], [stdout], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
sed 's,tp_basic_c,tp_basic_cpp,g' <resout >resexp
AT_CHECK([TEST_HELPER(tp_basic_cpp) -r resout fail],
         [1], [expout], [experr])
AT_CHECK([cmp -s resout resexp], [0], [], [])
sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
sed 's,tp_basic_c,tp_basic_sh,g' <resout >resexp
AT_CHECK([TEST_HELPER(tp_basic_sh) -r resout fail],
         [1], [expout], [experr])
AT_CHECK([cmp -s resout resexp], [0], [], [])

dnl Run the skip test case.
AT_CHECK([TEST_HELPER(tp_basic_c) -r resout skip],
         [0], [stdout], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
sed 's,tp_basic_c,tp_basic_cpp,g' <resout >resexp
AT_CHECK([TEST_HELPER(tp_basic_cpp) -r resout skip],
         [0], [expout], [experr])
AT_CHECK([cmp -s resout resexp], [0], [], [])
sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
sed 's,tp_basic_c,tp_basic_sh,g' <resout >resexp
AT_CHECK([TEST_HELPER(tp_basic_sh) -r resout skip],
         [0], [expout], [experr])
AT_CHECK([cmp -s resout resexp], [0], [], [])

dnl Run the default test case.
AT_CHECK([TEST_HELPER(tp_basic_c) -r resout default],
         [0], [stdout], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
sed 's,tp_basic_c,tp_basic_cpp,g' <resout >resexp
AT_CHECK([TEST_HELPER(tp_basic_cpp) -r resout default],
         [0], [expout], [experr])
AT_CHECK([cmp -s resout resexp], [0], [], [])
sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
sed 's,tp_basic_c,tp_basic_sh,g' <resout >resexp
AT_CHECK([TEST_HELPER(tp_basic_sh) -r resout default],
         [0], [expout], [experr])
AT_CHECK([cmp -s resout resexp], [0], [], [])

dnl Try running multiple tests.
AT_CHECK([TEST_HELPER(tp_basic_c) pass fail],
         [1], [stdout], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_cpp) pass fail],
         [1], [expout], [experr])
sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_sh) pass fail],
         [1], [expout], [experr])

dnl Run an unknown test case.
AT_CHECK([TEST_HELPER(tp_basic_c) unknown],
         [1], [stdout], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_cpp) unknown],
         [1], [expout], [experr])
sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_sh) unknown],
         [1], [expout], [experr])

dnl Try running a non-existent cleanup routine.
AT_CHECK([TEST_HELPER(tp_basic_c) pass:cleanup],
         [0], [stdout], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_cpp) pass:cleanup],
         [0], [expout], [experr])
sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_sh) pass:cleanup],
         [0], [expout], [experr])

dnl Run a test and dump the results on stdout.
AT_CHECK([TEST_HELPER(tp_basic_c) skip],
         [0], [stdout], [stderr])
sed 's,tp_basic_c,tp_basic_cpp,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_cpp,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_cpp) skip],
         [0], [expout], [experr])
sed 's,tp_basic_c,tp_basic_sh,g' <stdout >expout
sed 's,tp_basic_c,tp_basic_sh,g' <stderr >experr
AT_CHECK([TEST_HELPER(tp_basic_sh) skip],
         [0], [expout], [experr])

AT_CLEANUP()

dnl vim: syntax=m4:expandtab:shiftwidth=4:softtabstop=4