#! /bin/sh
# Copyright (C) 2011-2012 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 .
# Auxiliary script for tests on TAP support: checking testsuite summary.
am_parallel_tests=yes
. ./defs || Exit 1
br='============================================================================'
case $use_colors in
yes|no) ;;
*) fatal_ "invalid \$use_colors value '$use_colors'"
esac
fetch_tap_driver
cat > configure.ac < 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
st=0
if test $use_colors = yes; then
make_cmd="env AM_COLOR_TESTS=always $MAKE -e"
else
make_cmd=$MAKE
fi
$make_cmd check > stdout || st=$?
cat stdout
if test $expect_failure = yes; then
test $st -gt 0 || Exit 1
else
test $st -eq 0 || Exit 1
fi
$PERL -w "$testsrcdir"/extract-testsuite-summary 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='[0;31m'
grn='[0;32m'
lgn='[1;32m'
blu='[1;34m'
mgn='[0;35m'
brg='[1m'
std='[m'
echo AUTOMAKE_OPTIONS = color-tests >> Makefile.am
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 < all.test
do_check --pass < all.test
do_check --pass < all.test
do_check --fail < all.test
do_check --fail < all.test
do_check --fail < all.test < all.test < all.test < all.test < all.test < tap
# Lots of non-failures (300 per kind).
(cat tap && cat tap && cat tap) > all.test
test `wc -l > all.test # Test plan.
do_check --pass < all.test
test `wc -l > all.test # Test plan.
do_check --fail < all.test
test `wc -l > all.test # Test plan.
do_check --fail <