xref: /minix3/external/bsd/atf/dist/test-programs/cpp_helpers.cpp (revision 11be35a165022172ed3cea20f2b5df0307540b0e)
1*11be35a1SLionel Sambuc //
2*11be35a1SLionel Sambuc // Automated Testing Framework (atf)
3*11be35a1SLionel Sambuc //
4*11be35a1SLionel Sambuc // Copyright (c) 2007 The NetBSD Foundation, Inc.
5*11be35a1SLionel Sambuc // All rights reserved.
6*11be35a1SLionel Sambuc //
7*11be35a1SLionel Sambuc // Redistribution and use in source and binary forms, with or without
8*11be35a1SLionel Sambuc // modification, are permitted provided that the following conditions
9*11be35a1SLionel Sambuc // are met:
10*11be35a1SLionel Sambuc // 1. Redistributions of source code must retain the above copyright
11*11be35a1SLionel Sambuc //    notice, this list of conditions and the following disclaimer.
12*11be35a1SLionel Sambuc // 2. Redistributions in binary form must reproduce the above copyright
13*11be35a1SLionel Sambuc //    notice, this list of conditions and the following disclaimer in the
14*11be35a1SLionel Sambuc //    documentation and/or other materials provided with the distribution.
15*11be35a1SLionel Sambuc //
16*11be35a1SLionel Sambuc // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17*11be35a1SLionel Sambuc // CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18*11be35a1SLionel Sambuc // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19*11be35a1SLionel Sambuc // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20*11be35a1SLionel Sambuc // IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21*11be35a1SLionel Sambuc // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*11be35a1SLionel Sambuc // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23*11be35a1SLionel Sambuc // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24*11be35a1SLionel Sambuc // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25*11be35a1SLionel Sambuc // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26*11be35a1SLionel Sambuc // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27*11be35a1SLionel Sambuc // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*11be35a1SLionel Sambuc //
29*11be35a1SLionel Sambuc 
30*11be35a1SLionel Sambuc extern "C" {
31*11be35a1SLionel Sambuc #include <signal.h>
32*11be35a1SLionel Sambuc #include <unistd.h>
33*11be35a1SLionel Sambuc }
34*11be35a1SLionel Sambuc 
35*11be35a1SLionel Sambuc #include <cstdlib>
36*11be35a1SLionel Sambuc #include <fstream>
37*11be35a1SLionel Sambuc #include <iostream>
38*11be35a1SLionel Sambuc 
39*11be35a1SLionel Sambuc #include <atf-c++.hpp>
40*11be35a1SLionel Sambuc 
41*11be35a1SLionel Sambuc #include "atf-c++/detail/fs.hpp"
42*11be35a1SLionel Sambuc 
43*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
44*11be35a1SLionel Sambuc // Helper tests for "t_config".
45*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
46*11be35a1SLionel Sambuc 
47*11be35a1SLionel Sambuc ATF_TEST_CASE(config_unset);
ATF_TEST_CASE_HEAD(config_unset)48*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(config_unset)
49*11be35a1SLionel Sambuc {
50*11be35a1SLionel Sambuc     set_md_var("descr", "Helper test case for the t_config test program");
51*11be35a1SLionel Sambuc }
ATF_TEST_CASE_BODY(config_unset)52*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(config_unset)
53*11be35a1SLionel Sambuc {
54*11be35a1SLionel Sambuc     ATF_REQUIRE(!has_config_var("test"));
55*11be35a1SLionel Sambuc }
56*11be35a1SLionel Sambuc 
57*11be35a1SLionel Sambuc ATF_TEST_CASE(config_empty);
ATF_TEST_CASE_HEAD(config_empty)58*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(config_empty)
59*11be35a1SLionel Sambuc {
60*11be35a1SLionel Sambuc     set_md_var("descr", "Helper test case for the t_config test program");
61*11be35a1SLionel Sambuc }
ATF_TEST_CASE_BODY(config_empty)62*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(config_empty)
63*11be35a1SLionel Sambuc {
64*11be35a1SLionel Sambuc     ATF_REQUIRE_EQ(get_config_var("test"), "");
65*11be35a1SLionel Sambuc }
66*11be35a1SLionel Sambuc 
67*11be35a1SLionel Sambuc ATF_TEST_CASE(config_value);
ATF_TEST_CASE_HEAD(config_value)68*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(config_value)
69*11be35a1SLionel Sambuc {
70*11be35a1SLionel Sambuc     set_md_var("descr", "Helper test case for the t_config test program");
71*11be35a1SLionel Sambuc }
ATF_TEST_CASE_BODY(config_value)72*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(config_value)
73*11be35a1SLionel Sambuc {
74*11be35a1SLionel Sambuc     ATF_REQUIRE_EQ(get_config_var("test"), "foo");
75*11be35a1SLionel Sambuc }
76*11be35a1SLionel Sambuc 
77*11be35a1SLionel Sambuc ATF_TEST_CASE(config_multi_value);
ATF_TEST_CASE_HEAD(config_multi_value)78*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(config_multi_value)
79*11be35a1SLionel Sambuc {
80*11be35a1SLionel Sambuc     set_md_var("descr", "Helper test case for the t_config test program");
81*11be35a1SLionel Sambuc }
ATF_TEST_CASE_BODY(config_multi_value)82*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(config_multi_value)
83*11be35a1SLionel Sambuc {
84*11be35a1SLionel Sambuc     ATF_REQUIRE_EQ(get_config_var("test"), "foo bar");
85*11be35a1SLionel Sambuc }
86*11be35a1SLionel Sambuc 
87*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
88*11be35a1SLionel Sambuc // Helper tests for "t_expect".
89*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
90*11be35a1SLionel Sambuc 
91*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_pass_and_pass);
ATF_TEST_CASE_BODY(expect_pass_and_pass)92*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_pass_and_pass)
93*11be35a1SLionel Sambuc {
94*11be35a1SLionel Sambuc     expect_pass();
95*11be35a1SLionel Sambuc }
96*11be35a1SLionel Sambuc 
97*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_pass_but_fail_requirement);
ATF_TEST_CASE_BODY(expect_pass_but_fail_requirement)98*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_pass_but_fail_requirement)
99*11be35a1SLionel Sambuc {
100*11be35a1SLionel Sambuc     expect_pass();
101*11be35a1SLionel Sambuc     fail("Some reason");
102*11be35a1SLionel Sambuc }
103*11be35a1SLionel Sambuc 
104*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_pass_but_fail_check);
ATF_TEST_CASE_BODY(expect_pass_but_fail_check)105*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_pass_but_fail_check)
106*11be35a1SLionel Sambuc {
107*11be35a1SLionel Sambuc     expect_pass();
108*11be35a1SLionel Sambuc     fail_nonfatal("Some reason");
109*11be35a1SLionel Sambuc }
110*11be35a1SLionel Sambuc 
111*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_fail_and_fail_requirement);
ATF_TEST_CASE_BODY(expect_fail_and_fail_requirement)112*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_fail_and_fail_requirement)
113*11be35a1SLionel Sambuc {
114*11be35a1SLionel Sambuc     expect_fail("Fail reason");
115*11be35a1SLionel Sambuc     fail("The failure");
116*11be35a1SLionel Sambuc     expect_pass();
117*11be35a1SLionel Sambuc }
118*11be35a1SLionel Sambuc 
119*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_fail_and_fail_check);
ATF_TEST_CASE_BODY(expect_fail_and_fail_check)120*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_fail_and_fail_check)
121*11be35a1SLionel Sambuc {
122*11be35a1SLionel Sambuc     expect_fail("Fail first");
123*11be35a1SLionel Sambuc     fail_nonfatal("abc");
124*11be35a1SLionel Sambuc     expect_pass();
125*11be35a1SLionel Sambuc 
126*11be35a1SLionel Sambuc     expect_fail("And fail again");
127*11be35a1SLionel Sambuc     fail_nonfatal("def");
128*11be35a1SLionel Sambuc     expect_pass();
129*11be35a1SLionel Sambuc }
130*11be35a1SLionel Sambuc 
131*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_fail_but_pass);
ATF_TEST_CASE_BODY(expect_fail_but_pass)132*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_fail_but_pass)
133*11be35a1SLionel Sambuc {
134*11be35a1SLionel Sambuc     expect_fail("Fail first");
135*11be35a1SLionel Sambuc     fail_nonfatal("abc");
136*11be35a1SLionel Sambuc     expect_pass();
137*11be35a1SLionel Sambuc 
138*11be35a1SLionel Sambuc     expect_fail("Will not fail");
139*11be35a1SLionel Sambuc     expect_pass();
140*11be35a1SLionel Sambuc 
141*11be35a1SLionel Sambuc     expect_fail("And fail again");
142*11be35a1SLionel Sambuc     fail_nonfatal("def");
143*11be35a1SLionel Sambuc     expect_pass();
144*11be35a1SLionel Sambuc }
145*11be35a1SLionel Sambuc 
146*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_exit_any_and_exit);
ATF_TEST_CASE_BODY(expect_exit_any_and_exit)147*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_exit_any_and_exit)
148*11be35a1SLionel Sambuc {
149*11be35a1SLionel Sambuc     expect_exit(-1, "Call will exit");
150*11be35a1SLionel Sambuc     std::exit(EXIT_SUCCESS);
151*11be35a1SLionel Sambuc }
152*11be35a1SLionel Sambuc 
153*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_exit_code_and_exit);
ATF_TEST_CASE_BODY(expect_exit_code_and_exit)154*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_exit_code_and_exit)
155*11be35a1SLionel Sambuc {
156*11be35a1SLionel Sambuc     expect_exit(123, "Call will exit");
157*11be35a1SLionel Sambuc     std::exit(123);
158*11be35a1SLionel Sambuc }
159*11be35a1SLionel Sambuc 
160*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_exit_but_pass);
ATF_TEST_CASE_BODY(expect_exit_but_pass)161*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_exit_but_pass)
162*11be35a1SLionel Sambuc {
163*11be35a1SLionel Sambuc     expect_exit(-1, "Call won't exit");
164*11be35a1SLionel Sambuc }
165*11be35a1SLionel Sambuc 
166*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_signal_any_and_signal);
ATF_TEST_CASE_BODY(expect_signal_any_and_signal)167*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_signal_any_and_signal)
168*11be35a1SLionel Sambuc {
169*11be35a1SLionel Sambuc     expect_signal(-1, "Call will signal");
170*11be35a1SLionel Sambuc     ::kill(getpid(), SIGKILL);
171*11be35a1SLionel Sambuc }
172*11be35a1SLionel Sambuc 
173*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_signal_no_and_signal);
ATF_TEST_CASE_BODY(expect_signal_no_and_signal)174*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_signal_no_and_signal)
175*11be35a1SLionel Sambuc {
176*11be35a1SLionel Sambuc     expect_signal(SIGHUP, "Call will signal");
177*11be35a1SLionel Sambuc     ::kill(getpid(), SIGHUP);
178*11be35a1SLionel Sambuc }
179*11be35a1SLionel Sambuc 
180*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_signal_but_pass);
ATF_TEST_CASE_BODY(expect_signal_but_pass)181*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_signal_but_pass)
182*11be35a1SLionel Sambuc {
183*11be35a1SLionel Sambuc     expect_signal(-1, "Call won't signal");
184*11be35a1SLionel Sambuc }
185*11be35a1SLionel Sambuc 
186*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_death_and_exit);
ATF_TEST_CASE_BODY(expect_death_and_exit)187*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_death_and_exit)
188*11be35a1SLionel Sambuc {
189*11be35a1SLionel Sambuc     expect_death("Exit case");
190*11be35a1SLionel Sambuc     std::exit(123);
191*11be35a1SLionel Sambuc }
192*11be35a1SLionel Sambuc 
193*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_death_and_signal);
ATF_TEST_CASE_BODY(expect_death_and_signal)194*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_death_and_signal)
195*11be35a1SLionel Sambuc {
196*11be35a1SLionel Sambuc     expect_death("Signal case");
197*11be35a1SLionel Sambuc     kill(getpid(), SIGKILL);
198*11be35a1SLionel Sambuc }
199*11be35a1SLionel Sambuc 
200*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(expect_death_but_pass);
ATF_TEST_CASE_BODY(expect_death_but_pass)201*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_death_but_pass)
202*11be35a1SLionel Sambuc {
203*11be35a1SLionel Sambuc     expect_death("Call won't die");
204*11be35a1SLionel Sambuc }
205*11be35a1SLionel Sambuc 
206*11be35a1SLionel Sambuc ATF_TEST_CASE(expect_timeout_and_hang);
ATF_TEST_CASE_HEAD(expect_timeout_and_hang)207*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(expect_timeout_and_hang)
208*11be35a1SLionel Sambuc {
209*11be35a1SLionel Sambuc     set_md_var("timeout", "1");
210*11be35a1SLionel Sambuc }
ATF_TEST_CASE_BODY(expect_timeout_and_hang)211*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_timeout_and_hang)
212*11be35a1SLionel Sambuc {
213*11be35a1SLionel Sambuc     expect_timeout("Will overrun");
214*11be35a1SLionel Sambuc     ::sleep(5);
215*11be35a1SLionel Sambuc }
216*11be35a1SLionel Sambuc 
217*11be35a1SLionel Sambuc ATF_TEST_CASE(expect_timeout_but_pass);
ATF_TEST_CASE_HEAD(expect_timeout_but_pass)218*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(expect_timeout_but_pass)
219*11be35a1SLionel Sambuc {
220*11be35a1SLionel Sambuc     set_md_var("timeout", "1");
221*11be35a1SLionel Sambuc }
ATF_TEST_CASE_BODY(expect_timeout_but_pass)222*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(expect_timeout_but_pass)
223*11be35a1SLionel Sambuc {
224*11be35a1SLionel Sambuc     expect_timeout("Will just exit");
225*11be35a1SLionel Sambuc }
226*11be35a1SLionel Sambuc 
227*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
228*11be35a1SLionel Sambuc // Helper tests for "t_meta_data".
229*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
230*11be35a1SLionel Sambuc 
231*11be35a1SLionel Sambuc ATF_TEST_CASE(metadata_no_descr);
ATF_TEST_CASE_HEAD(metadata_no_descr)232*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(metadata_no_descr)
233*11be35a1SLionel Sambuc {
234*11be35a1SLionel Sambuc }
ATF_TEST_CASE_BODY(metadata_no_descr)235*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(metadata_no_descr)
236*11be35a1SLionel Sambuc {
237*11be35a1SLionel Sambuc }
238*11be35a1SLionel Sambuc 
239*11be35a1SLionel Sambuc ATF_TEST_CASE_WITHOUT_HEAD(metadata_no_head);
ATF_TEST_CASE_BODY(metadata_no_head)240*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(metadata_no_head)
241*11be35a1SLionel Sambuc {
242*11be35a1SLionel Sambuc }
243*11be35a1SLionel Sambuc 
244*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
245*11be35a1SLionel Sambuc // Helper tests for "t_srcdir".
246*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
247*11be35a1SLionel Sambuc 
248*11be35a1SLionel Sambuc ATF_TEST_CASE(srcdir_exists);
ATF_TEST_CASE_HEAD(srcdir_exists)249*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(srcdir_exists)
250*11be35a1SLionel Sambuc {
251*11be35a1SLionel Sambuc     set_md_var("descr", "Helper test case for the t_srcdir test program");
252*11be35a1SLionel Sambuc }
ATF_TEST_CASE_BODY(srcdir_exists)253*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(srcdir_exists)
254*11be35a1SLionel Sambuc {
255*11be35a1SLionel Sambuc     if (!atf::fs::exists(atf::fs::path(get_config_var("srcdir")) /
256*11be35a1SLionel Sambuc         "datafile"))
257*11be35a1SLionel Sambuc         ATF_FAIL("Cannot find datafile");
258*11be35a1SLionel Sambuc }
259*11be35a1SLionel Sambuc 
260*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
261*11be35a1SLionel Sambuc // Helper tests for "t_result".
262*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
263*11be35a1SLionel Sambuc 
264*11be35a1SLionel Sambuc ATF_TEST_CASE(result_pass);
ATF_TEST_CASE_HEAD(result_pass)265*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(result_pass) { }
ATF_TEST_CASE_BODY(result_pass)266*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(result_pass)
267*11be35a1SLionel Sambuc {
268*11be35a1SLionel Sambuc     std::cout << "msg\n";
269*11be35a1SLionel Sambuc }
270*11be35a1SLionel Sambuc 
271*11be35a1SLionel Sambuc ATF_TEST_CASE(result_fail);
ATF_TEST_CASE_HEAD(result_fail)272*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(result_fail) { }
ATF_TEST_CASE_BODY(result_fail)273*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(result_fail)
274*11be35a1SLionel Sambuc {
275*11be35a1SLionel Sambuc     std::cout << "msg\n";
276*11be35a1SLionel Sambuc     ATF_FAIL("Failure reason");
277*11be35a1SLionel Sambuc }
278*11be35a1SLionel Sambuc 
279*11be35a1SLionel Sambuc ATF_TEST_CASE(result_skip);
ATF_TEST_CASE_HEAD(result_skip)280*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(result_skip) { }
ATF_TEST_CASE_BODY(result_skip)281*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(result_skip)
282*11be35a1SLionel Sambuc {
283*11be35a1SLionel Sambuc     std::cout << "msg\n";
284*11be35a1SLionel Sambuc     ATF_SKIP("Skipped reason");
285*11be35a1SLionel Sambuc }
286*11be35a1SLionel Sambuc 
287*11be35a1SLionel Sambuc ATF_TEST_CASE(result_newlines_fail);
ATF_TEST_CASE_HEAD(result_newlines_fail)288*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(result_newlines_fail)
289*11be35a1SLionel Sambuc {
290*11be35a1SLionel Sambuc     set_md_var("descr", "Helper test case for the t_result test program");
291*11be35a1SLionel Sambuc }
ATF_TEST_CASE_BODY(result_newlines_fail)292*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(result_newlines_fail)
293*11be35a1SLionel Sambuc {
294*11be35a1SLionel Sambuc     ATF_FAIL("First line\nSecond line");
295*11be35a1SLionel Sambuc }
296*11be35a1SLionel Sambuc 
297*11be35a1SLionel Sambuc ATF_TEST_CASE(result_newlines_skip);
ATF_TEST_CASE_HEAD(result_newlines_skip)298*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(result_newlines_skip)
299*11be35a1SLionel Sambuc {
300*11be35a1SLionel Sambuc     set_md_var("descr", "Helper test case for the t_result test program");
301*11be35a1SLionel Sambuc }
ATF_TEST_CASE_BODY(result_newlines_skip)302*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(result_newlines_skip)
303*11be35a1SLionel Sambuc {
304*11be35a1SLionel Sambuc     ATF_SKIP("First line\nSecond line");
305*11be35a1SLionel Sambuc }
306*11be35a1SLionel Sambuc 
307*11be35a1SLionel Sambuc ATF_TEST_CASE(result_exception);
ATF_TEST_CASE_HEAD(result_exception)308*11be35a1SLionel Sambuc ATF_TEST_CASE_HEAD(result_exception) { }
ATF_TEST_CASE_BODY(result_exception)309*11be35a1SLionel Sambuc ATF_TEST_CASE_BODY(result_exception)
310*11be35a1SLionel Sambuc {
311*11be35a1SLionel Sambuc     throw std::runtime_error("This is unhandled");
312*11be35a1SLionel Sambuc }
313*11be35a1SLionel Sambuc 
314*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
315*11be35a1SLionel Sambuc // Main.
316*11be35a1SLionel Sambuc // ------------------------------------------------------------------------
317*11be35a1SLionel Sambuc 
ATF_INIT_TEST_CASES(tcs)318*11be35a1SLionel Sambuc ATF_INIT_TEST_CASES(tcs)
319*11be35a1SLionel Sambuc {
320*11be35a1SLionel Sambuc     // Add helper tests for t_config.
321*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, config_unset);
322*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, config_empty);
323*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, config_value);
324*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, config_multi_value);
325*11be35a1SLionel Sambuc 
326*11be35a1SLionel Sambuc     // Add helper tests for t_expect.
327*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_pass_and_pass);
328*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_pass_but_fail_requirement);
329*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_pass_but_fail_check);
330*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_fail_and_fail_requirement);
331*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_fail_and_fail_check);
332*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_fail_but_pass);
333*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_exit_any_and_exit);
334*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_exit_code_and_exit);
335*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_exit_but_pass);
336*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_signal_any_and_signal);
337*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_signal_no_and_signal);
338*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_signal_but_pass);
339*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_death_and_exit);
340*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_death_and_signal);
341*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_death_but_pass);
342*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_timeout_and_hang);
343*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, expect_timeout_but_pass);
344*11be35a1SLionel Sambuc 
345*11be35a1SLionel Sambuc     // Add helper tests for t_meta_data.
346*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, metadata_no_descr);
347*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, metadata_no_head);
348*11be35a1SLionel Sambuc 
349*11be35a1SLionel Sambuc     // Add helper tests for t_srcdir.
350*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, srcdir_exists);
351*11be35a1SLionel Sambuc 
352*11be35a1SLionel Sambuc     // Add helper tests for t_result.
353*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, result_pass);
354*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, result_fail);
355*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, result_skip);
356*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, result_newlines_fail);
357*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, result_newlines_skip);
358*11be35a1SLionel Sambuc     ATF_ADD_TEST_CASE(tcs, result_exception);
359*11be35a1SLionel Sambuc }
360