tests: never source test-defs.sh directly, source test-lib.sh instead
[platform/upstream/automake.git] / t / testsuite-summary-count.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Check test counts in the testsuite summary.
18
19 . test-lib.sh
20
21 use_colors=no; use_vpath=no
22 . testsuite-summary-checks.sh
23
24 ./configure
25
26 header="\
27 ${br}
28 Testsuite summary for GNU AutoFoo 7.1
29 ${br}"
30
31 success_footer=${br}
32
33 failure_footer="\
34 ${br}
35 See ./test-suite.log
36 Please report to bug-automake@gnu.org
37 ${br}"
38
39 # Corner cases.
40
41 do_check '' <<END
42 $header
43 # TOTAL: 0
44 # PASS:  0
45 # SKIP:  0
46 # XFAIL: 0
47 # FAIL:  0
48 # XPASS: 0
49 # ERROR: 0
50 $success_footer
51 END
52
53 do_check pass.t <<END
54 $header
55 # TOTAL: 1
56 # PASS:  1
57 # SKIP:  0
58 # XFAIL: 0
59 # FAIL:  0
60 # XPASS: 0
61 # ERROR: 0
62 $success_footer
63 END
64
65 do_check fail.t <<END
66 $header
67 # TOTAL: 1
68 # PASS:  0
69 # SKIP:  0
70 # XFAIL: 0
71 # FAIL:  1
72 # XPASS: 0
73 # ERROR: 0
74 $failure_footer
75 END
76
77 # Some simpler checks, with low or moderate number of tests.
78
79 do_check skip.t skip2.t skip3.t xfail.t xfail2.t <<END
80 $header
81 # TOTAL: 5
82 # PASS:  0
83 # SKIP:  3
84 # XFAIL: 2
85 # FAIL:  0
86 # XPASS: 0
87 # ERROR: 0
88 $success_footer
89 END
90
91 do_check pass.t pass2.t xfail.t xpass.t error.t error2.t <<END
92 $header
93 # TOTAL: 6
94 # PASS:  2
95 # SKIP:  0
96 # XFAIL: 1
97 # FAIL:  0
98 # XPASS: 1
99 # ERROR: 2
100 $failure_footer
101 END
102
103 pass_count=22
104 skip_count=19
105 xfail_count=21
106 fail_count=18
107 xpass_count=23
108 error_count=17
109 tests_count=120
110
111  pass=$(seq_ 1 $pass_count  | sed 's/.*/pass-&.t/')
112  skip=$(seq_ 1 $skip_count  | sed 's/.*/skip-&.t/')
113 xfail=$(seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/')
114  fail=$(seq_ 1 $fail_count  | sed 's/.*/fail-&.t/')
115 xpass=$(seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/')
116 error=$(seq_ 1 $error_count | sed 's/.*/error-&.t/')
117
118 do_check $pass $skip $xfail $fail $xpass $error <<END
119 $header
120 # TOTAL: $tests_count
121 # PASS:  $pass_count
122 # SKIP:  $skip_count
123 # XFAIL: $xfail_count
124 # FAIL:  $fail_count
125 # XPASS: $xpass_count
126 # ERROR: $error_count
127 $failure_footer
128 END
129
130 # Mild stress test with a lot of test scripts.
131
132 tests_count=1888
133 pass_count=1403
134 skip_count=292
135 xfail_count=41
136 fail_count=126
137 xpass_count=17
138 error_count=9
139
140  pass=$(seq_ 1 $pass_count  | sed 's/.*/pass-&.t/')
141  skip=$(seq_ 1 $skip_count  | sed 's/.*/skip-&.t/')
142 xfail=$(seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/')
143  fail=$(seq_ 1 $fail_count  | sed 's/.*/fail-&.t/')
144 xpass=$(seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/')
145 error=$(seq_ 1 $error_count | sed 's/.*/error-&.t/')
146
147 do_check $pass $skip $xfail $fail $xpass $error <<END
148 $header
149 # TOTAL: $tests_count
150 # PASS:  $pass_count
151 # SKIP:  $skip_count
152 # XFAIL: $xfail_count
153 # FAIL:  $fail_count
154 # XPASS: $xpass_count
155 # ERROR: $error_count
156 $failure_footer
157 END
158
159 :