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 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
|
#! /bin/sh
# Copyright (C) 2011-2021 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Auxiliary script for tests on TAP support: checking testsuite summary.
. test-init.sh
br='============================================================================'
case $use_colors in
yes|no) ;;
*) fatal_ "invalid \$use_colors value '$use_colors'"
esac
fetch_tap_driver
cat > configure.ac <<END
AC_INIT([GNU AutoTAP], [5.12], [bug-automake@gnu.org])
AM_INIT_AUTOMAKE
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
END
cat > Makefile.am << 'END'
TEST_LOG_DRIVER = $(srcdir)/tap-driver
TEST_LOG_COMPILER = cat
TESTS = all.test
END
# The following shell variables are influential for this function:
# - expect_failure
# - use_colors
do_check ()
{
case $#,$1 in
1,--pass) expect_failure=no;;
1,--fail) expect_failure=yes;;
*) fatal_ "invalid usage of 'do_check'";;
esac
shift
cat > summary.exp
cat all.test
if test $use_colors = yes; then
# Forced colorization should take place also with non-ANSI terminals;
# hence the "TERM=dumb" definition.
make_args='TERM=dumb AM_COLOR_TESTS=always'
else
make_args=
fi
run_make -O -e IGNORE $make_args check
if test $expect_failure = yes; then
test $am_make_rc -gt 0 || exit 1
else
test $am_make_rc -eq 0 || exit 1
fi
$PERL "$am_testaux_srcdir"/extract-testsuite-summary.pl stdout >summary.got \
|| fatal_ "cannot extract testsuite summary"
cat summary.exp
cat summary.got
if test $use_colors = yes; then
# Use cmp, not diff, because the files might contain binary data.
compare=cmp
else
compare=diff
fi
$compare summary.exp summary.got || exit 1
}
if test $use_colors = yes; then
red="$esc[0;31m"
grn="$esc[0;32m"
lgn="$esc[1;32m"
blu="$esc[1;34m"
mgn="$esc[0;35m"
brg="$esc[1m"
std="$esc[m"
else
red= grn= lgn= blu= mgn= brg= std=
fi
success_header="\
${grn}${br}${std}
${grn}Testsuite summary for GNU AutoTAP 5.12${std}
${grn}${br}${std}"
success_footer=${grn}${br}${std}
failure_header="\
${red}${br}${std}
${red}Testsuite summary for GNU AutoTAP 5.12${std}
${red}${br}${std}"
failure_footer="\
${red}${br}${std}
${red}See ./test-suite.log${std}
${red}Please report to bug-automake@gnu.org${std}
${red}${br}${std}"
$ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing
./configure
# 1 pass.
{ echo 1..1 && echo ok; } > all.test
do_check --pass <<END
$success_header
${brg}# TOTAL: 1${std}
${grn}# PASS: 1${std}
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
$success_footer
END
# 1 skip.
{ echo 1..1 && echo 'ok # SKIP'; } > all.test
do_check --pass <<END
$success_header
${brg}# TOTAL: 1${std}
# PASS: 0
${blu}# SKIP: 1${std}
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
$success_footer
END
# 1 xfail.
{ echo 1..1 && echo 'not ok # TODO'; } > all.test
do_check --pass <<END
$success_header
${brg}# TOTAL: 1${std}
# PASS: 0
# SKIP: 0
${lgn}# XFAIL: 1${std}
# FAIL: 0
# XPASS: 0
# ERROR: 0
$success_footer
END
# 1 fail.
{ echo 1..1 && echo not ok; } > all.test
do_check --fail <<END
$failure_header
${brg}# TOTAL: 1${std}
# PASS: 0
# SKIP: 0
# XFAIL: 0
${red}# FAIL: 1${std}
# XPASS: 0
# ERROR: 0
$failure_footer
END
# 1 xpass.
{ echo 1..1 && echo 'ok # TODO'; } > all.test
do_check --fail <<END
$failure_header
${brg}# TOTAL: 1${std}
# PASS: 0
# SKIP: 0
# XFAIL: 0
# FAIL: 0
${red}# XPASS: 1${std}
# ERROR: 0
$failure_footer
END
# 1 hard error.
{ echo 1..1 && echo 'Bail out!'; } > all.test
do_check --fail <<END
$failure_header
${brg}# TOTAL: 1${std}
# PASS: 0
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
${mgn}# ERROR: 1${std}
$failure_footer
END
# 3 non-failing results.
cat > all.test <<END
1..3
ok
not ok # TODO
ok # SKIP
END
do_check --pass <<END
$success_header
${brg}# TOTAL: 3${std}
${grn}# PASS: 1${std}
${blu}# SKIP: 1${std}
${lgn}# XFAIL: 1${std}
# FAIL: 0
# XPASS: 0
# ERROR: 0
$success_footer
END
# 1 pass, 1 skip, 1 fail.
cat > all.test <<END
1..3
ok
ok # SKIP
not ok
END
do_check --fail <<END
$failure_header
${brg}# TOTAL: 3${std}
${grn}# PASS: 1${std}
${blu}# SKIP: 1${std}
# XFAIL: 0
${red}# FAIL: 1${std}
# XPASS: 0
# ERROR: 0
$failure_footer
END
# 1 pass, 1 xfail, 1 xpass.
cat > all.test <<END
1..3
ok
ok # TODO
not ok # TODO
END
do_check --fail <<END
$failure_header
${brg}# TOTAL: 3${std}
${grn}# PASS: 1${std}
# SKIP: 0
${lgn}# XFAIL: 1${std}
# FAIL: 0
${red}# XPASS: 1${std}
# ERROR: 0
$failure_footer
END
# 1 skip, 1 xfail, 1 error.
cat > all.test <<END
1..3
ok # SKIP
not ok # TODO
Bail out!
END
do_check --fail <<END
$failure_header
${brg}# TOTAL: 3${std}
# PASS: 0
${blu}# SKIP: 1${std}
${lgn}# XFAIL: 1${std}
# FAIL: 0
# XPASS: 0
${mgn}# ERROR: 1${std}
$failure_footer
END
# 1 of each kind
cat > all.test <<END
1..6
ok
not ok
ok # TODO
not ok # TODO
ok # SKIP
Bail out!
END
do_check --fail <<END
$failure_header
${brg}# TOTAL: 6${std}
${grn}# PASS: 1${std}
${blu}# SKIP: 1${std}
${lgn}# XFAIL: 1${std}
${red}# FAIL: 1${std}
${red}# XPASS: 1${std}
${mgn}# ERROR: 1${std}
$failure_footer
END
# Prepare some common data for later.
for i in 0 1 2 3 4 5 6 7 8 9; do
for j in 0 1 2 3 4 5 6 7 8 9; do
echo "ok"
echo "not ok # TODO"
echo "ok # SKIP"
done
done > tap
# Lots of non-failures (300 per kind).
(cat tap && cat tap && cat tap) > all.test
test $(wc -l <all.test) -eq 900 || exit 99 # Sanity check.
echo 1..900 >> all.test # Test plan.
do_check --pass <<END
$success_header
${brg}# TOTAL: 900${std}
${grn}# PASS: 300${std}
${blu}# SKIP: 300${std}
${lgn}# XFAIL: 300${std}
# FAIL: 0
# XPASS: 0
# ERROR: 0
$success_footer
END
# 1 failure and lots of non-failures means failure.
(cat tap && echo "not ok" && cat tap) > all.test
test $(wc -l <all.test) -eq 601 || exit 99 # Sanity check.
echo 1..601 >> all.test # Test plan.
do_check --fail <<END
$failure_header
${brg}# TOTAL: 601${std}
${grn}# PASS: 200${std}
${blu}# SKIP: 200${std}
${lgn}# XFAIL: 200${std}
${red}# FAIL: 1${std}
# XPASS: 0
# ERROR: 0
$failure_footer
END
# 1 error and lots of non-failures means failure.
(cat tap && sed 30q tap && echo 'Bail out!') > all.test
test $(wc -l <all.test) -eq 331 || exit 99 # Sanity check.
echo 1..331 >> all.test # Test plan.
do_check --fail <<END
$failure_header
${brg}# TOTAL: 331${std}
${grn}# PASS: 110${std}
${blu}# SKIP: 110${std}
${lgn}# XFAIL: 110${std}
# FAIL: 0
# XPASS: 0
${mgn}# ERROR: 1${std}
$failure_footer
END
:
|