#! /bin/sh # Copyright (C) 2011-2017 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. . test-init.sh 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 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 < 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 <