1 # Copyright 2011 The Kyua Authors.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
13 # * Neither the name of Google Inc. nor the names of its contributors
14 # may be used to endorse or promote products derived from this software
15 # without specific prior written permission.
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 utils_test_case one_test_program__all_pass
31 one_test_program__all_pass_body() {
32 utils_install_stable_test_wrapper
36 test_suite("integration")
37 atf_test_program{name="simple_all_pass"}
41 simple_all_pass:pass -> passed [S.UUUs]
42 simple_all_pass:skip -> skipped: The reason for skipping is this [S.UUUs]
44 Results file id is $(utils_results_id)
45 Results saved to $(utils_results_file)
50 utils_cp_helper simple_all_pass .
51 atf_check -s exit:0 -o file:expout -e empty kyua test
55 utils_test_case one_test_program__some_fail
56 one_test_program__some_fail_body() {
57 utils_install_stable_test_wrapper
61 test_suite("integration")
62 atf_test_program{name="simple_some_fail"}
66 simple_some_fail:fail -> failed: This fails on purpose [S.UUUs]
67 simple_some_fail:pass -> passed [S.UUUs]
69 Results file id is $(utils_results_id)
70 Results saved to $(utils_results_file)
75 utils_cp_helper simple_some_fail .
76 atf_check -s exit:1 -o file:expout -e empty kyua test
80 utils_test_case many_test_programs__all_pass
81 many_test_programs__all_pass_body() {
82 utils_install_stable_test_wrapper
86 test_suite("integration")
87 atf_test_program{name="first"}
88 atf_test_program{name="second"}
89 atf_test_program{name="third"}
90 plain_test_program{name="fourth", required_files="/non-existent/foo"}
94 first:pass -> passed [S.UUUs]
95 first:skip -> skipped: The reason for skipping is this [S.UUUs]
96 fourth:main -> skipped: Required file '/non-existent/foo' not found [S.UUUs]
97 second:pass -> passed [S.UUUs]
98 second:skip -> skipped: The reason for skipping is this [S.UUUs]
99 third:pass -> passed [S.UUUs]
100 third:skip -> skipped: The reason for skipping is this [S.UUUs]
102 Results file id is $(utils_results_id)
103 Results saved to $(utils_results_file)
105 7/7 passed (0 failed)
108 utils_cp_helper simple_all_pass first
109 utils_cp_helper simple_all_pass second
110 utils_cp_helper simple_all_pass third
111 echo "not executed" >fourth; chmod +x fourth
112 atf_check -s exit:0 -o file:expout -e empty kyua test
116 utils_test_case many_test_programs__some_fail
117 many_test_programs__some_fail_body() {
118 utils_install_stable_test_wrapper
122 test_suite("integration")
123 atf_test_program{name="first"}
124 atf_test_program{name="second"}
125 atf_test_program{name="third"}
126 plain_test_program{name="fourth"}
130 first:fail -> failed: This fails on purpose [S.UUUs]
131 first:pass -> passed [S.UUUs]
132 fourth:main -> failed: Returned non-success exit status 76 [S.UUUs]
133 second:fail -> failed: This fails on purpose [S.UUUs]
134 second:pass -> passed [S.UUUs]
135 third:pass -> passed [S.UUUs]
136 third:skip -> skipped: The reason for skipping is this [S.UUUs]
138 Results file id is $(utils_results_id)
139 Results saved to $(utils_results_file)
141 4/7 passed (3 failed)
144 utils_cp_helper simple_some_fail first
145 utils_cp_helper simple_some_fail second
146 utils_cp_helper simple_all_pass third
147 echo '#! /bin/sh' >fourth
148 echo 'exit 76' >>fourth
150 atf_check -s exit:1 -o file:expout -e empty kyua test
154 utils_test_case expect__all_pass
155 expect__all_pass_body() {
156 utils_install_stable_test_wrapper
160 test_suite("integration")
161 atf_test_program{name="expect_all_pass"}
164 # CHECK_STYLE_DISABLE
166 expect_all_pass:die -> expected_failure: This is the reason for death [S.UUUs]
167 expect_all_pass:exit -> expected_failure: Exiting with correct code [S.UUUs]
168 expect_all_pass:failure -> expected_failure: Oh no: Forced failure [S.UUUs]
169 expect_all_pass:signal -> expected_failure: Exiting with correct signal [S.UUUs]
170 expect_all_pass:timeout -> expected_failure: This times out [S.UUUs]
172 Results file id is $(utils_results_id)
173 Results saved to $(utils_results_file)
175 5/5 passed (0 failed)
179 utils_cp_helper expect_all_pass .
180 atf_check -s exit:0 -o file:expout -e empty kyua test
184 utils_test_case expect__some_fail
185 expect__some_fail_body() {
186 utils_install_stable_test_wrapper
190 test_suite("integration")
191 atf_test_program{name="expect_some_fail"}
194 # CHECK_STYLE_DISABLE
196 expect_some_fail:die -> failed: Test case was expected to terminate abruptly but it continued execution [S.UUUs]
197 expect_some_fail:exit -> failed: Test case expected to exit with code 12 but got code 34 [S.UUUs]
198 expect_some_fail:failure -> failed: Test case was expecting a failure but none were raised [S.UUUs]
199 expect_some_fail:pass -> passed [S.UUUs]
200 expect_some_fail:signal -> failed: Test case expected to receive signal 15 but got 9 [S.UUUs]
201 expect_some_fail:timeout -> failed: Test case was expected to hang but it continued execution [S.UUUs]
203 Results file id is $(utils_results_id)
204 Results saved to $(utils_results_file)
206 1/6 passed (5 failed)
210 utils_cp_helper expect_some_fail .
211 atf_check -s exit:1 -o file:expout -e empty kyua test
215 utils_test_case premature_exit
216 premature_exit_body() {
217 utils_install_stable_test_wrapper
221 test_suite("integration")
222 atf_test_program{name="bogus_test_cases"}
225 # CHECK_STYLE_DISABLE
227 bogus_test_cases:die -> broken: Premature exit; test case received signal 9 [S.UUUs]
228 bogus_test_cases:exit -> broken: Premature exit; test case exited with code 0 [S.UUUs]
229 bogus_test_cases:pass -> passed [S.UUUs]
231 Results file id is $(utils_results_id)
232 Results saved to $(utils_results_file)
234 1/3 passed (2 failed)
238 utils_cp_helper bogus_test_cases .
239 atf_check -s exit:1 -o file:expout -e empty kyua test
243 utils_test_case no_args
245 utils_install_stable_test_wrapper
249 test_suite("integration")
250 atf_test_program{name="simple_all_pass"}
251 include("subdir/Kyuafile")
253 utils_cp_helper metadata .
254 utils_cp_helper simple_all_pass .
257 cat >subdir/Kyuafile <<EOF
259 test_suite("integration2")
260 atf_test_program{name="simple_some_fail"}
262 utils_cp_helper simple_some_fail subdir
265 simple_all_pass:pass -> passed [S.UUUs]
266 simple_all_pass:skip -> skipped: The reason for skipping is this [S.UUUs]
267 subdir/simple_some_fail:fail -> failed: This fails on purpose [S.UUUs]
268 subdir/simple_some_fail:pass -> passed [S.UUUs]
270 Results file id is $(utils_results_id)
271 Results saved to $(utils_results_file)
273 3/4 passed (1 failed)
275 atf_check -s exit:1 -o file:expout -e empty kyua test
279 utils_test_case one_arg__subdir
280 one_arg__subdir_body() {
281 utils_install_stable_test_wrapper
285 test_suite("top-level")
286 include("subdir/Kyuafile")
290 cat >subdir/Kyuafile <<EOF
292 test_suite("in-subdir")
293 atf_test_program{name="simple_all_pass"}
295 utils_cp_helper simple_all_pass subdir
297 # CHECK_STYLE_DISABLE
299 subdir/simple_all_pass:pass -> passed [S.UUUs]
300 subdir/simple_all_pass:skip -> skipped: The reason for skipping is this [S.UUUs]
302 Results file id is $(utils_results_id)
303 Results saved to $(utils_results_file)
305 2/2 passed (0 failed)
308 atf_check -s exit:0 -o file:expout -e empty kyua test subdir
312 utils_test_case one_arg__test_case
313 one_arg__test_case_body() {
314 utils_install_stable_test_wrapper
318 test_suite("top-level")
319 atf_test_program{name="first"}
320 atf_test_program{name="second"}
322 utils_cp_helper simple_all_pass first
323 utils_cp_helper simple_all_pass second
326 first:skip -> skipped: The reason for skipping is this [S.UUUs]
328 Results file id is $(utils_results_id)
329 Results saved to $(utils_results_file)
331 1/1 passed (0 failed)
333 atf_check -s exit:0 -o file:expout -e empty kyua test first:skip
337 utils_test_case one_arg__test_program
338 one_arg__test_program_body() {
339 utils_install_stable_test_wrapper
343 test_suite("top-level")
344 atf_test_program{name="first"}
345 atf_test_program{name="second"}
347 utils_cp_helper simple_all_pass first
348 utils_cp_helper simple_some_fail second
351 second:fail -> failed: This fails on purpose [S.UUUs]
352 second:pass -> passed [S.UUUs]
354 Results file id is $(utils_results_id)
355 Results saved to $(utils_results_file)
357 1/2 passed (1 failed)
359 atf_check -s exit:1 -o file:expout -e empty kyua test second
363 utils_test_case one_arg__invalid
364 one_arg__invalid_body() {
366 kyua: E: Test case component in 'foo:' is empty.
368 atf_check -s exit:2 -o empty -e file:experr kyua test foo:
371 kyua: E: Program name '/a/b' must be relative to the test suite, not absolute.
373 atf_check -s exit:2 -o empty -e file:experr kyua test /a/b
377 utils_test_case many_args__ok
378 many_args__ok_body() {
379 utils_install_stable_test_wrapper
383 test_suite("top-level")
384 include("subdir/Kyuafile")
385 atf_test_program{name="first"}
387 utils_cp_helper simple_all_pass first
390 cat >subdir/Kyuafile <<EOF
392 test_suite("in-subdir")
393 atf_test_program{name="second"}
395 utils_cp_helper simple_some_fail subdir/second
398 first:pass -> passed [S.UUUs]
399 subdir/second:fail -> failed: This fails on purpose [S.UUUs]
400 subdir/second:pass -> passed [S.UUUs]
402 Results file id is $(utils_results_id)
403 Results saved to $(utils_results_file)
405 2/3 passed (1 failed)
407 atf_check -s exit:1 -o file:expout -e empty kyua test subdir first:pass
411 utils_test_case many_args__invalid
412 many_args__invalid_body() {
414 kyua: E: Program name component in ':badbad' is empty.
416 atf_check -s exit:2 -o empty -e file:experr kyua test this-is-ok :badbad
419 kyua: E: Program name '/foo' must be relative to the test suite, not absolute.
421 atf_check -s exit:2 -o empty -e file:experr kyua test this-is-ok /foo
425 utils_test_case many_args__no_match__all
426 many_args__no_match__all_body() {
427 utils_install_stable_test_wrapper
431 test_suite("top-level")
432 atf_test_program{name="first"}
433 atf_test_program{name="second"}
435 utils_cp_helper simple_all_pass first
436 utils_cp_helper simple_all_pass second
439 Results file id is $(utils_results_id)
440 Results saved to $(utils_results_file)
443 kyua: W: No test cases matched by the filter 'first1'.
445 atf_check -s exit:1 -o file:expout -e file:experr kyua test first1
449 utils_test_case many_args__no_match__some
450 many_args__no_match__some_body() {
451 utils_install_stable_test_wrapper
455 test_suite("top-level")
456 atf_test_program{name="first"}
457 atf_test_program{name="second"}
458 atf_test_program{name="third"}
460 utils_cp_helper simple_all_pass first
461 utils_cp_helper simple_all_pass second
462 utils_cp_helper simple_some_fail third
465 first:pass -> passed [S.UUUs]
466 first:skip -> skipped: The reason for skipping is this [S.UUUs]
467 third:fail -> failed: This fails on purpose [S.UUUs]
468 third:pass -> passed [S.UUUs]
470 Results file id is $(utils_results_id)
471 Results saved to $(utils_results_file)
473 3/4 passed (1 failed)
477 kyua: W: No test cases matched by the filter 'fifth'.
478 kyua: W: No test cases matched by the filter 'fourth'.
480 atf_check -s exit:1 -o file:expout -e file:experr kyua test first fourth \
485 utils_test_case args_are_relative
486 args_are_relative_body() {
487 utils_install_stable_test_wrapper
490 cat >root/Kyuafile <<EOF
492 test_suite("integration-1")
493 atf_test_program{name="first"}
494 atf_test_program{name="second"}
495 include("subdir/Kyuafile")
497 utils_cp_helper simple_all_pass root/first
498 utils_cp_helper simple_some_fail root/second
501 cat >root/subdir/Kyuafile <<EOF
503 test_suite("integration-2")
504 atf_test_program{name="third"}
505 atf_test_program{name="fourth"}
507 utils_cp_helper simple_all_pass root/subdir/third
508 utils_cp_helper simple_some_fail root/subdir/fourth
511 first:pass -> passed [S.UUUs]
512 first:skip -> skipped: The reason for skipping is this [S.UUUs]
513 subdir/fourth:fail -> failed: This fails on purpose [S.UUUs]
515 Results file id is $(utils_results_id root)
516 Results saved to $(utils_results_file root)
518 2/3 passed (1 failed)
520 atf_check -s exit:1 -o file:expout -e empty kyua test \
521 -k "$(pwd)/root/Kyuafile" first subdir/fourth:fail
525 utils_test_case only_load_used_test_programs
526 only_load_used_test_programs_body() {
527 utils_install_stable_test_wrapper
531 test_suite("integration")
532 atf_test_program{name="first"}
533 atf_test_program{name="second"}
535 utils_cp_helper simple_all_pass first
536 utils_cp_helper bad_test_program second
539 first:pass -> passed [S.UUUs]
540 first:skip -> skipped: The reason for skipping is this [S.UUUs]
542 Results file id is $(utils_results_id)
543 Results saved to $(utils_results_file)
545 2/2 passed (0 failed)
547 CREATE_COOKIE="$(pwd)/cookie"; export CREATE_COOKIE
548 atf_check -s exit:0 -o file:expout -e empty kyua test first
549 if [ -f "${CREATE_COOKIE}" ]; then
550 atf_fail "An unmatched test case has been executed, which harms" \
556 utils_test_case config_behavior
557 config_behavior_body() {
558 cat >"my-config" <<EOF
560 test_suites.suite1["the-variable"] = "value1"
561 test_suites.suite2["the-variable"] = "override me"
566 atf_test_program{name="config1", test_suite="suite1"}
567 atf_test_program{name="config2", test_suite="suite2"}
568 atf_test_program{name="config3", test_suite="suite3"}
570 utils_cp_helper config config1
571 utils_cp_helper config config2
572 utils_cp_helper config config3
574 atf_check -s exit:1 -o save:stdout -e empty \
575 kyua -c my-config -v test_suites.suite2.the-variable=value2 test
576 atf_check -s exit:0 -o ignore -e empty \
577 grep 'config1:get_variable.*failed' stdout
578 atf_check -s exit:0 -o ignore -e empty \
579 grep 'config2:get_variable.*passed' stdout
580 atf_check -s exit:0 -o ignore -e empty \
581 grep 'config3:get_variable.*skipped' stdout
583 CONFIG_VAR_FILE="$(pwd)/cookie"; export CONFIG_VAR_FILE
584 if [ -f "${CONFIG_VAR_FILE}" ]; then
585 atf_fail "Cookie file already created; test case list may have gotten" \
586 "a bad configuration"
588 atf_check -s exit:1 -o ignore -e empty kyua -c my-config test config1
589 [ -f "${CONFIG_VAR_FILE}" ] || \
590 atf_fail "Cookie file not created; test case list did not get" \
591 "configuration variables"
592 value="$(cat "${CONFIG_VAR_FILE}")"
593 [ "${value}" = "value1" ] || \
594 atf_fail "Invalid value (${value}) in cookie file; test case list did" \
595 "not get the correct configuration variables"
599 utils_test_case store_contents
600 store_contents_body() {
601 utils_install_stable_test_wrapper
605 atf_test_program{name="some-program", test_suite="suite1"}
607 utils_cp_helper simple_some_fail some-program
609 some-program:fail -> failed: This fails on purpose [S.UUUs]
610 some-program:pass -> passed [S.UUUs]
612 Results file id is $(utils_results_id)
613 Results saved to $(utils_results_file)
615 1/2 passed (1 failed)
618 atf_check -s exit:1 -o file:expout -e empty kyua test
621 some-program,fail,failed,This fails on purpose
622 some-program,pass,passed,NULL
624 atf_check -s exit:0 -o file:expout -e empty \
625 kyua db-exec --no-headers \
627 " test_programs.relative_path, test_cases.name, " \
628 " test_results.result_type, test_results.result_reason " \
629 "FROM test_programs " \
630 " JOIN test_cases " \
631 " ON test_programs.test_program_id = test_cases.test_program_id " \
632 " JOIN test_results " \
633 " ON test_cases.test_case_id = test_results.test_case_id " \
634 "ORDER BY test_programs.relative_path, test_cases.name"
638 utils_test_case results_file__ok
639 results_file__ok_body() {
642 atf_test_program{name="config1", test_suite="suite1"}
644 utils_cp_helper config config1
646 atf_check -s exit:0 -o ignore -e empty kyua test -r foo1.db
647 test -f foo1.db || atf_fail "-s did not work"
648 atf_check -s exit:0 -o ignore -e empty kyua test --results-file=foo2.db
649 test -f foo2.db || atf_fail "--results-file did not work"
650 test ! -f .kyua/store.db || atf_fail "Default database created"
654 utils_test_case results_file__fail
655 results_file__fail_body() {
658 atf_test_program{name="config1", test_suite="suite1"}
660 utils_cp_helper config config1
662 atf_check -s exit:3 -o empty -e match:"Invalid.*--results-file" \
663 kyua test --results-file=
667 utils_test_case results_file__reuse
668 results_file__reuse_body() {
669 utils_install_stable_test_wrapper
673 atf_test_program{name="simple_all_pass", test_suite="integration"}
675 utils_cp_helper simple_all_pass .
676 atf_check -s exit:0 -o ignore -e empty kyua test -r results.db
678 atf_check -s exit:2 -o empty -e match:"results.db already exists" \
679 kyua test --results-file="results.db"
683 utils_test_case build_root_flag
684 build_root_flag_body() {
685 utils_install_stable_test_wrapper
689 test_suite("integration")
690 atf_test_program{name="first"}
691 include("subdir/Kyuafile")
695 cat >subdir/Kyuafile <<EOF
697 test_suite("integration")
698 atf_test_program{name="second"}
699 atf_test_program{name="third"}
703 first:pass -> passed [S.UUUs]
704 first:skip -> skipped: The reason for skipping is this [S.UUUs]
705 subdir/second:pass -> passed [S.UUUs]
706 subdir/second:skip -> skipped: The reason for skipping is this [S.UUUs]
707 subdir/third:pass -> passed [S.UUUs]
708 subdir/third:skip -> skipped: The reason for skipping is this [S.UUUs]
710 Results file id is $(utils_results_id)
711 Results saved to $(utils_results_file)
713 6/6 passed (0 failed)
718 utils_cp_helper simple_all_pass build/first
719 utils_cp_helper simple_all_pass build/subdir/second
720 utils_cp_helper simple_all_pass build/subdir/third
722 atf_check -s exit:0 -o file:expout -e empty kyua test --build-root=build
726 utils_test_case kyuafile_flag__no_args
727 kyuafile_flag__no_args_body() {
728 utils_install_stable_test_wrapper
731 This file is bogus but it is not loaded.
736 test_suite("integration")
737 atf_test_program{name="sometest"}
739 utils_cp_helper simple_all_pass sometest
742 sometest:pass -> passed [S.UUUs]
743 sometest:skip -> skipped: The reason for skipping is this [S.UUUs]
745 Results file id is $(utils_results_id)
746 Results saved to $(utils_results_file)
748 2/2 passed (0 failed)
750 atf_check -s exit:0 -o file:expout -e empty kyua test -k myfile
751 atf_check -s exit:0 -o file:expout -e empty kyua test --kyuafile=myfile
755 utils_test_case kyuafile_flag__some_args
756 kyuafile_flag__some_args_body() {
757 utils_install_stable_test_wrapper
760 This file is bogus but it is not loaded.
765 test_suite("hello-world")
766 atf_test_program{name="sometest"}
768 utils_cp_helper simple_all_pass sometest
771 sometest:pass -> passed [S.UUUs]
772 sometest:skip -> skipped: The reason for skipping is this [S.UUUs]
774 Results file id is $(utils_results_id)
775 Results saved to $(utils_results_file)
777 2/2 passed (0 failed)
779 atf_check -s exit:0 -o file:expout -e empty kyua test -k myfile sometest
781 sometest:pass -> passed [S.UUUs]
782 sometest:skip -> skipped: The reason for skipping is this [S.UUUs]
784 Results file id is $(utils_results_id)
785 Results saved to $(utils_results_file)
787 2/2 passed (0 failed)
789 atf_check -s exit:0 -o file:expout -e empty kyua test --kyuafile=myfile \
794 utils_test_case interrupt
798 test_suite("integration")
799 atf_test_program{name="interrupts"}
801 utils_cp_helper interrupts .
804 -v test_suites.integration.body-cookie="$(pwd)/body" \
805 -v test_suites.integration.cleanup-cookie="$(pwd)/cleanup" \
806 test >stdout 2>stderr &
808 echo "Kyua subprocess is PID ${pid}"
810 while [ ! -f body ]; do
811 echo "Waiting for body to start"
817 echo "Sending INT signal to ${pid}"
819 echo "Waiting for process ${pid} to exit"
822 sed -e 's,^,kyua stdout:,' stdout
823 sed -e 's,^,kyua stderr:,' stderr
824 echo "Process ${pid} exited"
825 [ ${ret} -ne 0 ] || atf_fail 'No error code reported'
827 [ -f cleanup ] || atf_fail 'Cleanup part not executed after signal'
830 atf_check -s exit:0 -o ignore -e empty grep 'Signal caught' stderr
831 atf_check -s exit:0 -o ignore -e empty \
832 grep 'kyua: E: Interrupted by signal' stderr
836 utils_test_case exclusive_tests
837 exclusive_tests_body() {
840 test_suite("integration")
842 for i in $(seq 100); do
843 echo 'plain_test_program{name="race", is_exclusive=true}' >>Kyuafile
845 utils_cp_helper race .
849 -o match:"100/100 passed" \
852 -v test_suites.integration.shared_file="$(pwd)/shared_file" \
857 utils_test_case no_test_program_match
858 no_test_program_match_body() {
859 utils_install_stable_test_wrapper
863 test_suite("integration")
864 atf_test_program{name="first"}
866 utils_cp_helper simple_all_pass first
867 utils_cp_helper simple_all_pass second
870 Results file id is $(utils_results_id)
871 Results saved to $(utils_results_file)
874 kyua: W: No test cases matched by the filter 'second'.
876 atf_check -s exit:1 -o file:expout -e file:experr kyua test second
880 utils_test_case no_test_case_match
881 no_test_case_match_body() {
882 utils_install_stable_test_wrapper
886 test_suite("integration")
887 atf_test_program{name="first"}
889 utils_cp_helper simple_all_pass first
892 Results file id is $(utils_results_id)
893 Results saved to $(utils_results_file)
896 kyua: W: No test cases matched by the filter 'first:foobar'.
898 atf_check -s exit:1 -o file:expout -e file:experr kyua test first:foobar
902 utils_test_case missing_kyuafile__no_args
903 missing_kyuafile__no_args_body() {
905 kyua: E: Load of 'Kyuafile' failed: File 'Kyuafile' not found.
907 atf_check -s exit:2 -o empty -e file:experr kyua test
911 utils_test_case missing_kyuafile__test_program
912 missing_kyuafile__test_program_body() {
914 cat >subdir/Kyuafile <<EOF
916 test_suite("integration")
917 atf_test_program{name="unused"}
919 utils_cp_helper simple_all_pass subdir/unused
922 kyua: E: Load of 'Kyuafile' failed: File 'Kyuafile' not found.
924 atf_check -s exit:2 -o empty -e file:experr kyua test subdir/unused
928 utils_test_case missing_kyuafile__subdir
929 missing_kyuafile__subdir_body() {
931 cat >subdir/Kyuafile <<EOF
933 test_suite("integration")
934 atf_test_program{name="unused"}
936 utils_cp_helper simple_all_pass subdir/unused
939 kyua: E: Load of 'Kyuafile' failed: File 'Kyuafile' not found.
941 atf_check -s exit:2 -o empty -e file:experr kyua test subdir
945 utils_test_case bogus_config
946 bogus_config_body() {
948 cat >"${HOME}/.kyua/kyua.conf" <<EOF
952 file_re='.*\.kyua/kyua.conf'
953 atf_check -s exit:2 -o empty \
954 -e match:"^kyua: E: Load of '${file_re}' failed: Failed to load Lua" \
959 utils_test_case bogus_kyuafile
960 bogus_kyuafile_body() {
964 atf_check -s exit:2 -o empty \
965 -e match:"Load of 'Kyuafile' failed: .* Kyuafile:2:" kyua list
969 utils_test_case bogus_test_program
970 bogus_test_program_body() {
971 utils_install_stable_test_wrapper
975 test_suite("integration")
976 atf_test_program{name="crash_on_list"}
977 atf_test_program{name="non_executable"}
979 utils_cp_helper bad_test_program crash_on_list
980 echo 'I am not executable' >non_executable
982 # CHECK_STYLE_DISABLE
984 crash_on_list:__test_cases_list__ -> broken: Invalid header for test case list; expecting Content-Type for application/X-atf-tp version 1, got '' [S.UUUs]
985 non_executable:__test_cases_list__ -> broken: Permission denied to run test program [S.UUUs]
987 Results file id is $(utils_results_id)
988 Results saved to $(utils_results_file)
990 0/2 passed (2 failed)
993 atf_check -s exit:1 -o file:expout -e empty kyua test
997 utils_test_case missing_test_program
998 missing_test_program_body() {
1001 include("subdir/Kyuafile")
1004 cat >subdir/Kyuafile <<EOF
1006 test_suite("integration")
1007 atf_test_program{name="ok"}
1008 atf_test_program{name="i-am-missing"}
1010 echo 'I should not be touched because the Kyuafile is bogus' >subdir/ok
1012 # CHECK_STYLE_DISABLE
1014 kyua: E: Load of 'Kyuafile' failed: .*Non-existent test program 'subdir/i-am-missing'.
1016 # CHECK_STYLE_ENABLE
1017 atf_check -s exit:2 -o empty -e "match:$(cat experr)" kyua list
1021 atf_init_test_cases() {
1022 atf_add_test_case one_test_program__all_pass
1023 atf_add_test_case one_test_program__some_fail
1024 atf_add_test_case many_test_programs__all_pass
1025 atf_add_test_case many_test_programs__some_fail
1026 atf_add_test_case expect__all_pass
1027 atf_add_test_case expect__some_fail
1028 atf_add_test_case premature_exit
1030 atf_add_test_case no_args
1031 atf_add_test_case one_arg__subdir
1032 atf_add_test_case one_arg__test_case
1033 atf_add_test_case one_arg__test_program
1034 atf_add_test_case one_arg__invalid
1035 atf_add_test_case many_args__ok
1036 atf_add_test_case many_args__invalid
1037 atf_add_test_case many_args__no_match__all
1038 atf_add_test_case many_args__no_match__some
1040 atf_add_test_case args_are_relative
1042 atf_add_test_case only_load_used_test_programs
1044 atf_add_test_case config_behavior
1046 atf_add_test_case store_contents
1047 atf_add_test_case results_file__ok
1048 atf_add_test_case results_file__fail
1049 atf_add_test_case results_file__reuse
1051 atf_add_test_case build_root_flag
1053 atf_add_test_case kyuafile_flag__no_args
1054 atf_add_test_case kyuafile_flag__some_args
1056 atf_add_test_case interrupt
1058 atf_add_test_case exclusive_tests
1060 atf_add_test_case no_test_program_match
1061 atf_add_test_case no_test_case_match
1063 atf_add_test_case missing_kyuafile__no_args
1064 atf_add_test_case missing_kyuafile__test_program
1065 atf_add_test_case missing_kyuafile__subdir
1067 atf_add_test_case bogus_config
1068 atf_add_test_case bogus_kyuafile
1069 atf_add_test_case bogus_test_program
1070 atf_add_test_case missing_test_program