| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 | #! /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/>.# Basic TAP test protocol support:#  - "Bail out!" magic. test-init.sh. tap-setup.sh: > exp#------------------------------------------------------------------# Bailout without explanation.cat > a.test <<END1..4ok 1not ok 2Bail out!not ok 3ok 4 # SKIPENDcat >> exp <<ENDPASS: a.test 1FAIL: a.test 2ERROR: a.test - Bail out!END# pass += 1, fail +=1, error += 1#------------------------------------------------------------------# Bailout with explanation.cat > b.test <<END1..7ok 1 # SKIPok 2 # TODOnot ok 3 # TODOBail out! We're out of disk space.ok 4not ok 5not ok 6 # TODOok 7 # TODOENDcat >> exp <<ENDSKIP: b.test 1 # SKIPXPASS: b.test 2 # TODOXFAIL: b.test 3 # TODOERROR: b.test - Bail out! We're out of disk space.END# skip += 1, xpass += 1, xfail += 1, error += 1#------------------------------------------------------------------# Bail out before the test plan.cat > c.test <<ENDok 1ok 2Bail out! BOOOH!1..2ENDcat >> exp <<ENDPASS: c.test 1PASS: c.test 2ERROR: c.test - Bail out! BOOOH!END# pass += 2, error += 1#------------------------------------------------------------------# Bailout on the first line.cat > d.test <<ENDBail out! mktemp -d: Permission deniedok 1ENDecho 'ERROR: d.test - Bail out! mktemp -d: Permission denied' >> exp# error += 1#------------------------------------------------------------------# TAP input comprised only of a bailout directive.cat > e.test <<ENDBail out!ENDecho "ERROR: e.test - Bail out!" >> exp# error += 1#------------------------------------------------------------------# Doing the sums above, we have:test_counts='total=12 pass=3 fail=1 xpass=1 xfail=1 skip=1 error=5'run_make -O -e FAIL TESTS='a.test b.test c.test d.test e.test' checkcount_test_results $test_countsLC_ALL=C sort exp > tmv -f t exp# We need the sort below to account for parallel make usage.grep ': [abcde]\.test' stdout | LC_ALL=C sort > gotcat expcat gotdiff exp got:
 |