| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 | #! /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 <http://www.gnu.org/licenses/>.# TAP support:#  - unplanned tests are properly reported as errors. test-init.sh. tap-setup.shcat > all.test <<END1..1ok 1ok 2ENDrun_make -O -e FAIL checkcount_test_results total=3 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=2grep '^ERROR: all\.test - too many tests run (expected 1, got 2)$' stdoutgrep '^ERROR: all\.test 2 # UNPLANNED$' stdoutcat > all.test <<END1..2ok 1ok 2ok 3ENDrun_make -O -e FAIL checkcount_test_results total=4 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=2grep '^ERROR: all\.test - too many tests run (expected 2, got 3)$' stdoutgrep '^ERROR: all\.test 3 # UNPLANNED$' stdout# Interaction with XFAIL_TESTS.cat > all.test <<END1..2not ok 1ok 2 # SKIPok 3not ok 4ok 5 # SKIPENDrun_make -O -e FAIL XFAIL_TESTS=all.test checkcount_test_results total=6 pass=0 fail=0 xpass=0 xfail=1 skip=1 error=4grep '^ERROR: all\.test - too many tests run (expected 2, got 5)$' stdoutgrep '^ERROR: all\.test 3 # UNPLANNED$' stdoutgrep '^ERROR: all\.test 4 # UNPLANNED$' stdoutgrep '^ERROR: all\.test 5 # UNPLANNED$' stdoutcat > all.test <<END1..1ok 1okok 3ok foook 5 - bar barnot oknot ok 7not ok foonot ok 9 - bar barok # TODOok 11 # TODOok foo # TODOok 13 - bar bar # TODOnot ok # TODOnot ok 15 # TODOnot ok foo # TODOnot ok 17 - bar bar # TODOok # SKIPok 19 # SKIPok foo # SKIPok 21 - bar bar # SKIPENDcat > t <<END234 foo5 - bar bar678 foo9 - bar bar101112 foo13 - bar bar141516 foo17 - bar bar181920 foo21 - bar barENDrun_make -O -e FAIL checkcount_test_results total=22 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=21echo 'PASS: all.test 1' > expsed -e '/^$/d' -e 's/.*/ERROR: all.test & # UNPLANNED/' t >> expecho 'ERROR: all.test - too many tests run (expected 1, got 21)' >> exp$FGREP ': all.test' stdout > gotcat expcat gotdiff exp got# Note that, if the TAP input has a trailing plan, it is not possible# to flag unplanned tests as such, since we do not know they're unplanned# until the plan is reached; still, we should give at least an error# message about the unmatched number of tests once we've got the plan.for x in 'ok' 'ok 3' 'not ok' 'not ok # TODO' 'ok # TODO' 'ok # SKIP'; do  unindent > all.test <<END    ok 1    ok 2 # SKIP    $x    1..2END  run_make -O -e FAIL check  test $($FGREP -c ': all.test' stdout) -eq 4  $EGREP '^PASS: all\.test 1($| )' stdout  $EGREP '^SKIP: all\.test 2($| )' stdout  $EGREP ': all\.test 3($| )' stdout  grep '^ERROR: all\.test - too many tests run (expected 2, got 3)$' stdoutdone:
 |