2 // Automated Testing Framework (atf)
4 // Copyright (c) 2010 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
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.
36 #include "atf-c++/macros.hpp"
38 #include "atf-c++/detail/parser.hpp"
39 #include "atf-c++/detail/sanity.hpp"
40 #include "atf-c++/detail/test_helpers.hpp"
41 #include "atf-c++/detail/text.hpp"
45 namespace impl
= atf::atf_report
;
47 class tps_reader
: protected impl::atf_tps_reader
{
49 got_info(const std::string
& what
, const std::string
& val
)
51 m_calls
.push_back("got_info(" + what
+ ", " + val
+ ")");
57 m_calls
.push_back("got_ntps(" + atf::text::to_string(ntps
) + ")");
61 got_tp_start(const std::string
& tpname
, size_t ntcs
)
63 m_calls
.push_back("got_tp_start(" + tpname
+ ", " +
64 atf::text::to_string(ntcs
) + ")");
68 got_tp_end(struct timeval
* tv ATF_DEFS_ATTRIBUTE_UNUSED
,
69 const std::string
& reason
)
71 m_calls
.push_back("got_tp_end(" + reason
+ ")");
75 got_tc_start(const std::string
& tcname
)
77 m_calls
.push_back("got_tc_start(" + tcname
+ ")");
81 got_tc_end(const std::string
& state
,
82 struct timeval
* tv ATF_DEFS_ATTRIBUTE_UNUSED
,
83 const std::string
& reason
)
85 const std::string r
= state
+ (reason
.empty() ? "" : ", " + reason
);
86 m_calls
.push_back("got_tc_end(" + r
+ ")");
90 got_tc_stdout_line(const std::string
& line
)
92 m_calls
.push_back("got_tc_stdout_line(" + line
+ ")");
96 got_tc_stderr_line(const std::string
& line
)
98 m_calls
.push_back("got_tc_stderr_line(" + line
+ ")");
104 m_calls
.push_back("got_eof()");
108 tps_reader(std::istream
& is
) :
109 impl::atf_tps_reader(is
)
116 atf_tps_reader::read();
119 std::vector
< std::string
> m_calls
;
122 ATF_TEST_CASE_WITHOUT_HEAD(tps_1
);
123 ATF_TEST_CASE_BODY(tps_1
)
126 "Content-Type: application/X-atf-tps; version=\"3\"\n"
131 const char* exp_calls
[] = {
137 const char* exp_errors
[] = {
141 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
144 ATF_TEST_CASE_WITHOUT_HEAD(tps_2
);
145 ATF_TEST_CASE_BODY(tps_2
)
148 "Content-Type: application/X-atf-tps; version=\"3\"\n"
151 "tp-start: 123.456, first-prog, 0\n"
152 "tp-end: 123.567, first-prog\n"
153 "tp-start: 123.678, second-prog, 0\n"
154 "tp-end: 123.789, second-prog, This program failed\n"
157 const char* exp_calls
[] = {
159 "got_tp_start(first-prog, 0)",
161 "got_tp_start(second-prog, 0)",
162 "got_tp_end(This program failed)",
167 const char* exp_errors
[] = {
171 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
174 ATF_TEST_CASE_WITHOUT_HEAD(tps_3
);
175 ATF_TEST_CASE_BODY(tps_3
)
178 "Content-Type: application/X-atf-tps; version=\"3\"\n"
181 "tp-start: 123.123, first-prog, 3\n"
182 "tc-start: 123.234, first-test\n"
183 "tc-end: 123.345, first-test, passed\n"
184 "tc-start: 123.456, second-test\n"
185 "tc-end: 123.567, second-test, skipped, Testing skipped reason\n"
186 "tc-start: 123.678, third.test\n"
187 "tc-end: 123.789, third.test, failed, Testing failed reason\n"
188 "tp-end: 123.890, first-prog\n"
189 "tp-start: 124.901, second-prog, 3\n"
190 "tc-start: 124.1012, first-test\n"
191 "tc-so:first stdout line for 1st test\n"
192 "tc-se:first stderr line for 1st test\n"
193 "tc-so:second stdout line for 1st test\n"
194 "tc-se:second stderr line for 1st test\n"
195 "tc-end: 124.1123, first-test, passed\n"
196 "tc-start: 124.1234, second-test\n"
197 "tc-so:first stdout line for 2nd test\n"
198 "tc-se:first stderr line for 2nd test\n"
199 "tc-so:second stdout line for 2nd test\n"
200 "tc-se:second stderr line for 2nd test\n"
201 "tc-end: 124.1345, second-test, skipped, Testing skipped reason\n"
202 "tc-start: 124.1456, third.test\n"
203 "tc-so:first stdout line for 3rd test\n"
204 "tc-se:first stderr line for 3rd test\n"
205 "tc-so:second stdout line for 3rd test\n"
206 "tc-se:second stderr line for 3rd test\n"
207 "tc-end: 124.1567, third.test, failed, Testing failed reason\n"
208 "tp-end: 124.1678, second-prog, This program failed\n"
211 const char* exp_calls
[] = {
213 "got_tp_start(first-prog, 3)",
214 "got_tc_start(first-test)",
215 "got_tc_end(passed)",
216 "got_tc_start(second-test)",
217 "got_tc_end(skipped, Testing skipped reason)",
218 "got_tc_start(third.test)",
219 "got_tc_end(failed, Testing failed reason)",
221 "got_tp_start(second-prog, 3)",
222 "got_tc_start(first-test)",
223 "got_tc_stdout_line(first stdout line for 1st test)",
224 "got_tc_stderr_line(first stderr line for 1st test)",
225 "got_tc_stdout_line(second stdout line for 1st test)",
226 "got_tc_stderr_line(second stderr line for 1st test)",
227 "got_tc_end(passed)",
228 "got_tc_start(second-test)",
229 "got_tc_stdout_line(first stdout line for 2nd test)",
230 "got_tc_stderr_line(first stderr line for 2nd test)",
231 "got_tc_stdout_line(second stdout line for 2nd test)",
232 "got_tc_stderr_line(second stderr line for 2nd test)",
233 "got_tc_end(skipped, Testing skipped reason)",
234 "got_tc_start(third.test)",
235 "got_tc_stdout_line(first stdout line for 3rd test)",
236 "got_tc_stderr_line(first stderr line for 3rd test)",
237 "got_tc_stdout_line(second stdout line for 3rd test)",
238 "got_tc_stderr_line(second stderr line for 3rd test)",
239 "got_tc_end(failed, Testing failed reason)",
240 "got_tp_end(This program failed)",
245 const char* exp_errors
[] = {
249 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
252 ATF_TEST_CASE_WITHOUT_HEAD(tps_4
);
253 ATF_TEST_CASE_BODY(tps_4
)
256 "Content-Type: application/X-atf-tps; version=\"3\"\n"
262 "tp-start: 234.1, first-prog, 3\n"
263 "tc-start: 234.12, first-test\n"
264 "tc-end: 234.23, first-test, passed\n"
265 "tc-start: 234.34, second-test\n"
266 "tc-end: 234.45, second-test, skipped, Testing skipped reason\n"
267 "tc-start: 234.56, third-test\n"
268 "tc-end: 234.67, third-test, failed, Testing failed reason\n"
269 "tp-end: 234.78, first-prog\n"
270 "tp-start: 234.89, second-prog, 3\n"
271 "tc-start: 234.90, first-test\n"
272 "tc-so:first stdout line for 1st test\n"
273 "tc-se:first stderr line for 1st test\n"
274 "tc-so:second stdout line for 1st test\n"
275 "tc-se:second stderr line for 1st test\n"
276 "tc-end: 234.101, first-test, passed\n"
277 "tc-start: 234.112, second-test\n"
278 "tc-so:first stdout line for 2nd test\n"
279 "tc-se:first stderr line for 2nd test\n"
280 "tc-so:second stdout line for 2nd test\n"
281 "tc-se:second stderr line for 2nd test\n"
282 "tc-end: 234.123, second-test, skipped, Testing skipped reason\n"
283 "tc-start: 234.134, third-test\n"
284 "tc-so:first stdout line for 3rd test\n"
285 "tc-se:first stderr line for 3rd test\n"
286 "tc-so:second stdout line for 3rd test\n"
287 "tc-se:second stderr line for 3rd test\n"
288 "tc-end: 234.145, third-test, failed, Testing failed reason\n"
289 "tp-end: 234.156, second-prog, This program failed\n"
295 const char* exp_calls
[] = {
300 "got_tp_start(first-prog, 3)",
301 "got_tc_start(first-test)",
302 "got_tc_end(passed)",
303 "got_tc_start(second-test)",
304 "got_tc_end(skipped, Testing skipped reason)",
305 "got_tc_start(third-test)",
306 "got_tc_end(failed, Testing failed reason)",
308 "got_tp_start(second-prog, 3)",
309 "got_tc_start(first-test)",
310 "got_tc_stdout_line(first stdout line for 1st test)",
311 "got_tc_stderr_line(first stderr line for 1st test)",
312 "got_tc_stdout_line(second stdout line for 1st test)",
313 "got_tc_stderr_line(second stderr line for 1st test)",
314 "got_tc_end(passed)",
315 "got_tc_start(second-test)",
316 "got_tc_stdout_line(first stdout line for 2nd test)",
317 "got_tc_stderr_line(first stderr line for 2nd test)",
318 "got_tc_stdout_line(second stdout line for 2nd test)",
319 "got_tc_stderr_line(second stderr line for 2nd test)",
320 "got_tc_end(skipped, Testing skipped reason)",
321 "got_tc_start(third-test)",
322 "got_tc_stdout_line(first stdout line for 3rd test)",
323 "got_tc_stderr_line(first stderr line for 3rd test)",
324 "got_tc_stdout_line(second stdout line for 3rd test)",
325 "got_tc_stderr_line(second stderr line for 3rd test)",
326 "got_tc_end(failed, Testing failed reason)",
327 "got_tp_end(This program failed)",
335 const char* exp_errors
[] = {
339 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
342 ATF_TEST_CASE_WITHOUT_HEAD(tps_5
);
343 ATF_TEST_CASE_BODY(tps_5
)
346 "Content-Type: application/X-atf-tps; version=\"3\"\n"
349 "tp-start: 345.123, the-prog, 1\n"
350 "tc-start: 345.134, the-test\n"
351 "tc-so:--- a 2007-11-04 14:00:41.000000000 +0100\n"
352 "tc-so:+++ b 2007-11-04 14:00:48.000000000 +0100\n"
353 "tc-so:@@ -1,7 +1,7 @@\n"
354 "tc-so: This test is meant to simulate a diff.\n"
355 "tc-so: Blank space at beginning of context lines must be preserved.\n"
357 "tc-so:-First original line.\n"
358 "tc-so:-Second original line.\n"
359 "tc-so:+First modified line.\n"
360 "tc-so:+Second modified line.\n"
363 "tc-end: 345.145, the-test, passed\n"
364 "tp-end: 345.156, the-prog\n"
367 // NO_CHECK_STYLE_BEGIN
368 const char* exp_calls
[] = {
370 "got_tp_start(the-prog, 1)",
371 "got_tc_start(the-test)",
372 "got_tc_stdout_line(--- a 2007-11-04 14:00:41.000000000 +0100)",
373 "got_tc_stdout_line(+++ b 2007-11-04 14:00:48.000000000 +0100)",
374 "got_tc_stdout_line(@@ -1,7 +1,7 @@)",
375 "got_tc_stdout_line( This test is meant to simulate a diff.)",
376 "got_tc_stdout_line( Blank space at beginning of context lines must be preserved.)",
377 "got_tc_stdout_line( )",
378 "got_tc_stdout_line(-First original line.)",
379 "got_tc_stdout_line(-Second original line.)",
380 "got_tc_stdout_line(+First modified line.)",
381 "got_tc_stdout_line(+Second modified line.)",
382 "got_tc_stdout_line( )",
383 "got_tc_stdout_line( EOF)",
384 "got_tc_end(passed)",
389 // NO_CHECK_STYLE_END
391 const char* exp_errors
[] = {
395 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
398 ATF_TEST_CASE_WITHOUT_HEAD(tps_6
);
399 ATF_TEST_CASE_BODY(tps_6
)
402 "Content-Type: application/X-atf-tps; version=\"3\"\n"
405 "tp-start: 321.1, the-prog, 8\n"
406 "tc-start: 321.12, one\n"
407 "tc-end: 321.23, one, expected_death, The reason\n"
408 "tc-start: 321.34, two\n"
409 "tc-end: 321.45, two, expected_exit, This would be an exit\n"
410 "tc-start: 321.56, three\n"
411 "tc-end: 321.67, three, expected_failure, And this a failure\n"
412 "tc-start: 321.78, four\n"
413 "tc-end: 321.89, four, expected_signal, And this a signal\n"
414 "tc-start: 321.90, five\n"
415 "tc-end: 321.101, five, failed, Another reason\n"
416 "tc-start: 321.112, six\n"
417 "tc-end: 321.123, six, passed\n"
418 "tc-start: 321.134, seven\n"
419 "tc-end: 321.145, seven, skipped, Skipping it\n"
420 "tc-start: 321.156, eight\n"
421 "tc-end: 321.167, eight, expected_timeout, Some hang reason\n"
422 "tp-end: 321.178, the-prog\n"
425 // NO_CHECK_STYLE_BEGIN
426 const char* exp_calls
[] = {
428 "got_tp_start(the-prog, 8)",
430 "got_tc_end(expected_death, The reason)",
432 "got_tc_end(expected_exit, This would be an exit)",
433 "got_tc_start(three)",
434 "got_tc_end(expected_failure, And this a failure)",
435 "got_tc_start(four)",
436 "got_tc_end(expected_signal, And this a signal)",
437 "got_tc_start(five)",
438 "got_tc_end(failed, Another reason)",
440 "got_tc_end(passed)",
441 "got_tc_start(seven)",
442 "got_tc_end(skipped, Skipping it)",
443 "got_tc_start(eight)",
444 "got_tc_end(expected_timeout, Some hang reason)",
449 // NO_CHECK_STYLE_END
451 const char* exp_errors
[] = {
455 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
459 ATF_TEST_CASE_WITHOUT_HEAD(tps_50
);
460 ATF_TEST_CASE_BODY(tps_50
)
463 "Content-Type: application/X-atf-tps; version=\"3\"\n"
468 const char* exp_calls
[] = {
472 const char* exp_errors
[] = {
473 "3: Unexpected token `foo'; expected tps-count or info field",
477 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
480 ATF_TEST_CASE_WITHOUT_HEAD(tps_51
);
481 ATF_TEST_CASE_BODY(tps_51
)
484 "Content-Type: application/X-atf-tps; version=\"3\"\n"
489 const char* exp_calls
[] = {
493 const char* exp_errors
[] = {
494 "3: Unexpected token `<<NEWLINE>>'; expected `:'",
498 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
501 ATF_TEST_CASE_WITHOUT_HEAD(tps_52
);
502 ATF_TEST_CASE_BODY(tps_52
)
505 "Content-Type: application/X-atf-tps; version=\"3\"\n"
510 const char* exp_calls
[] = {
514 const char* exp_errors
[] = {
515 "3: Unexpected token `<<NEWLINE>>'; expected number of test programs",
519 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
522 ATF_TEST_CASE_WITHOUT_HEAD(tps_53
);
523 ATF_TEST_CASE_BODY(tps_53
)
526 "Content-Type: application/X-atf-tps; version=\"3\"\n"
532 const char* exp_calls
[] = {
537 const char* exp_errors
[] = {
538 "4: Unexpected token `foo'; expected start of test program",
542 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
545 ATF_TEST_CASE_WITHOUT_HEAD(tps_54
);
546 ATF_TEST_CASE_BODY(tps_54
)
549 "Content-Type: application/X-atf-tps; version=\"3\"\n"
557 "tp-start: 123.456\n"
558 "tp-start: 123.456,\n"
559 "tp-start: 123.456, foo\n"
560 "tp-start: 123.456, foo,\n"
561 "tp-start: 123.456, foo, 0\n"
563 "tp-start: 456.789, foo, 0\n"
565 "tp-start: 777.777, foo, 0\n"
567 "tp-start: 777.777, foo, 0\n"
569 "tp-start: 777.777, foo, 0\n"
571 "tp-start: 777.777, foo, 0\n"
573 "tp-start: 777.777, foo, 0\n"
574 "tp-end: 777.888, \n"
575 "tp-start: 777.777, foo, 0\n"
576 "tp-end: 777.888, bar\n"
577 "tp-start: 777.777, foo, 0\n"
578 "tp-end: 777.888, foo,\n"
581 const char* exp_calls
[] = {
586 const char* exp_errors
[] = {
587 "4: Unexpected token `foo'; expected start of test program",
588 "5: Unexpected token `<<NEWLINE>>'; expected `:'",
589 "6: Unexpected token `<<NEWLINE>>'; expected timestamp",
590 "7: Malformed timestamp value 123",
591 "8: Malformed timestamp value 123.",
592 "9: Unexpected token `<<NEWLINE>>'; expected `,'",
593 "10: Unexpected token `<<NEWLINE>>'; expected test program name",
594 "11: Unexpected token `<<NEWLINE>>'; expected `,'",
595 "12: Unexpected token `<<NEWLINE>>'; expected number of test programs",
596 "14: Unexpected token `bar'; expected end of test program",
597 "16: Unexpected token `<<NEWLINE>>'; expected `:'",
598 "18: Unexpected token `<<NEWLINE>>'; expected timestamp",
599 "20: Malformed timestamp value 777",
600 "22: Malformed timestamp value 777.",
601 "24: Unexpected token `<<NEWLINE>>'; expected `,'",
603 "26: Unexpected token `<<NEWLINE>>'; expected test program name",
604 "28: Test program name used in terminator does not match opening",
605 "30: Empty reason for failed test program",
609 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
612 ATF_TEST_CASE_WITHOUT_HEAD(tps_55
);
613 ATF_TEST_CASE_BODY(tps_55
)
616 "Content-Type: application/X-atf-tps; version=\"3\"\n"
619 "tp-start: 100.200, foo, 1\n"
625 "tc-start: 111.222\n"
626 "tc-start: 111.222,\n"
627 "tc-start: 111.222, foo\n"
629 "tc-start: 111.333, foo\n"
631 "tc-start: 111.444, foo\n"
633 "tc-start: 111.444, foo\n"
635 "tc-start: 111.444, foo\n"
637 "tc-start: 111.444, foo\n"
639 "tc-start: 111.444, foo\n"
640 "tc-end: 111.555, \n"
641 "tc-start: 111.444, foo\n"
642 "tc-end: 111.555, bar\n"
643 "tc-start: 111.444, foo\n"
644 "tc-end: 111.555, foo\n"
645 "tc-start: 111.444, foo\n"
646 "tc-end: 111.555, foo,\n"
647 "tp-end: 111.666, foo\n"
650 const char* exp_calls
[] = {
652 "got_tp_start(foo, 1)",
656 // NO_CHECK_STYLE_BEGIN
657 const char* exp_errors
[] = {
658 "5: Unexpected token `foo'; expected start of test case",
659 "6: Unexpected token `<<NEWLINE>>'; expected `:'",
660 "7: Unexpected token `<<NEWLINE>>'; expected timestamp",
661 "8: Malformed timestamp value 111",
662 "9: Malformed timestamp value 111.",
663 "10: Unexpected token `<<NEWLINE>>'; expected `,'",
664 "11: Unexpected token `<<NEWLINE>>'; expected test case name",
665 "13: Unexpected token `bar'; expected end of test case or test case's stdout/stderr line",
666 "15: Unexpected token `<<NEWLINE>>'; expected `:'",
667 "17: Unexpected token `<<NEWLINE>>'; expected timestamp",
668 "19: Malformed timestamp value 111",
669 "21: Malformed timestamp value 111.",
670 "23: Unexpected token `<<NEWLINE>>'; expected `,'",
671 "25: Unexpected token `<<NEWLINE>>'; expected test case name",
672 "27: Test case name used in terminator does not match opening",
673 "29: Unexpected token `<<NEWLINE>>'; expected `,'",
674 "31: Unexpected token `<<NEWLINE>>'; expected expected_{death,exit,failure,signal,timeout}, failed, passed or skipped",
675 "32: Unexpected token `tp-end'; expected start of test case",
678 // NO_CHECK_STYLE_END
680 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
683 ATF_TEST_CASE_WITHOUT_HEAD(tps_56
);
684 ATF_TEST_CASE_BODY(tps_56
)
687 "Content-Type: application/X-atf-tps; version=\"3\"\n"
690 "tp-start: 111.222, foo, 1\n"
691 "tc-start: 111.333, foo\n"
692 "tc-end: 111.444, foo, passe\n"
693 "tc-start: 111.333, foo\n"
694 "tc-end: 111.444, foo, passed,\n"
695 "tc-start: 111.555, bar\n"
696 "tc-end: 111.666, bar, failed\n"
697 "tc-start: 111.555, bar\n"
698 "tc-end: 111.666, bar, failed,\n"
699 "tc-start: 111.555, baz\n"
700 "tc-end: 111.666, baz, skipped\n"
701 "tc-start: 111.555, baz\n"
702 "tc-end: 111.666, baz, skipped,\n"
703 "tp-end: 111.777, foo\n"
706 const char* exp_calls
[] = {
708 "got_tp_start(foo, 1)",
713 // NO_CHECK_STYLE_BEGIN
714 const char* exp_errors
[] = {
715 "6: Unexpected token `passe'; expected expected_{death,exit,failure,signal,timeout}, failed, passed or skipped",
716 "8: Unexpected token `,'; expected new line",
717 "10: Unexpected token `<<NEWLINE>>'; expected `,'",
718 "12: Empty reason for failed test case result",
719 "14: Unexpected token `<<NEWLINE>>'; expected `,'",
720 "16: Empty reason for skipped test case result",
721 "17: Unexpected token `tp-end'; expected start of test case",
724 // NO_CHECK_STYLE_END
726 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
729 ATF_TEST_CASE_WITHOUT_HEAD(tps_57
);
730 ATF_TEST_CASE_BODY(tps_57
)
733 "Content-Type: application/X-atf-tps; version=\"3\"\n"
736 "tp-start: 111.222, foo, 0\n"
737 "tp-end: 111.333, foo\n"
740 const char* exp_calls
[] = {
742 "got_tp_start(foo, 0)",
747 const char* exp_errors
[] = {
748 "6: Unexpected token `<<EOF>>'; expected start of test program",
752 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
755 ATF_TEST_CASE_WITHOUT_HEAD(tps_58
);
756 ATF_TEST_CASE_BODY(tps_58
)
759 "Content-Type: application/X-atf-tps; version=\"3\"\n"
762 "tp-start: 111.222, foo, 0\n"
763 "tp-end: 111.333, foo\n"
764 "tp-start: 111.444, bar, 0\n"
765 "tp-end: 111.555, bar\n"
768 const char* exp_calls
[] = {
770 "got_tp_start(foo, 0)",
775 const char* exp_errors
[] = {
776 "6: Unexpected token `tp-start'; expected end of stream or info field",
780 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
783 ATF_TEST_CASE_WITHOUT_HEAD(tps_59
);
784 ATF_TEST_CASE_BODY(tps_59
)
787 "Content-Type: application/X-atf-tps; version=\"3\"\n"
792 const char* exp_calls
[] = {
796 const char* exp_errors
[] = {
797 "3: Unexpected token `<<NEWLINE>>'; expected `:'",
801 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
804 ATF_TEST_CASE_WITHOUT_HEAD(tps_60
);
805 ATF_TEST_CASE_BODY(tps_60
)
808 "Content-Type: application/X-atf-tps; version=\"3\"\n"
813 const char* exp_calls
[] = {
817 const char* exp_errors
[] = {
818 "3: Unexpected token `<<NEWLINE>>'; expected info property name",
822 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
825 ATF_TEST_CASE_WITHOUT_HEAD(tps_61
);
826 ATF_TEST_CASE_BODY(tps_61
)
829 "Content-Type: application/X-atf-tps; version=\"3\"\n"
834 const char* exp_calls
[] = {
838 const char* exp_errors
[] = {
839 "3: Unexpected token `<<NEWLINE>>'; expected `,'",
843 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
846 ATF_TEST_CASE_WITHOUT_HEAD(tps_62
);
847 ATF_TEST_CASE_BODY(tps_62
)
850 "Content-Type: application/X-atf-tps; version=\"3\"\n"
855 const char* exp_calls
[] = {
860 const char* exp_errors
[] = {
861 "4: Unexpected token `<<EOF>>'; expected tps-count or info field",
865 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
868 ATF_TEST_CASE_WITHOUT_HEAD(tps_63
);
869 ATF_TEST_CASE_BODY(tps_63
)
872 "Content-Type: application/X-atf-tps; version=\"3\"\n"
877 const char* exp_calls
[] = {
882 const char* exp_errors
[] = {
883 "4: Unexpected token `<<EOF>>'; expected tps-count or info field",
887 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
890 ATF_TEST_CASE_WITHOUT_HEAD(tps_64
);
891 ATF_TEST_CASE_BODY(tps_64
)
894 "Content-Type: application/X-atf-tps; version=\"3\"\n"
897 "info: a.b.c.def, g\n"
901 const char* exp_calls
[] = {
903 "got_info(a.b.c.def, g)",
907 const char* exp_errors
[] = {
908 "5: Unexpected token `<<NEWLINE>>'; expected `:'",
912 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
915 ATF_TEST_CASE_WITHOUT_HEAD(tps_65
);
916 ATF_TEST_CASE_BODY(tps_65
)
919 "Content-Type: application/X-atf-tps; version=\"3\"\n"
925 const char* exp_calls
[] = {
930 const char* exp_errors
[] = {
931 "4: Unexpected token `<<NEWLINE>>'; expected number of test programs",
935 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
938 ATF_TEST_CASE_WITHOUT_HEAD(tps_66
);
939 ATF_TEST_CASE_BODY(tps_66
)
942 "Content-Type: application/X-atf-tps; version=\"3\"\n"
949 const char* exp_calls
[] = {
955 const char* exp_errors
[] = {
956 "5: Unexpected token `<<NEWLINE>>'; expected `:'",
960 do_parser_test
< tps_reader
>(input
, exp_calls
, exp_errors
);
963 ATF_INIT_TEST_CASES(tcs
)
965 ATF_ADD_TEST_CASE(tcs
, tps_1
);
966 ATF_ADD_TEST_CASE(tcs
, tps_2
);
967 ATF_ADD_TEST_CASE(tcs
, tps_3
);
968 ATF_ADD_TEST_CASE(tcs
, tps_4
);
969 ATF_ADD_TEST_CASE(tcs
, tps_5
);
970 ATF_ADD_TEST_CASE(tcs
, tps_6
);
971 ATF_ADD_TEST_CASE(tcs
, tps_50
);
972 ATF_ADD_TEST_CASE(tcs
, tps_51
);
973 ATF_ADD_TEST_CASE(tcs
, tps_52
);
974 ATF_ADD_TEST_CASE(tcs
, tps_53
);
975 ATF_ADD_TEST_CASE(tcs
, tps_54
);
976 ATF_ADD_TEST_CASE(tcs
, tps_55
);
977 ATF_ADD_TEST_CASE(tcs
, tps_56
);
978 ATF_ADD_TEST_CASE(tcs
, tps_57
);
979 ATF_ADD_TEST_CASE(tcs
, tps_58
);
980 ATF_ADD_TEST_CASE(tcs
, tps_59
);
981 ATF_ADD_TEST_CASE(tcs
, tps_60
);
982 ATF_ADD_TEST_CASE(tcs
, tps_61
);
983 ATF_ADD_TEST_CASE(tcs
, tps_62
);
984 ATF_ADD_TEST_CASE(tcs
, tps_63
);
985 ATF_ADD_TEST_CASE(tcs
, tps_64
);
986 ATF_ADD_TEST_CASE(tcs
, tps_65
);
987 ATF_ADD_TEST_CASE(tcs
, tps_66
);