| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 | #! /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/>.# Parallel testsuite harness: check APIs for the registering the# "global test result" in '*.trs' files, as documented in the automake# manual.. test-init.shcat >> configure.ac << 'END'AC_OUTPUTENDcat > Makefile.am << 'END'TEST_EXTENSIONS = .test .xTEST_LOG_DRIVER = ./dummy-driverX_LOG_DRIVER = ./dummy-driverTESTS = foo.test zar-doz.testENDcat > dummy-driver <<'END'#! /bin/shset -e; set -uwhile test $# -gt 0; do  case $1 in    --log-file) log_file=$2; shift;;    --trs-file) trs_file=$2; shift;;    --test-name) test_name=$2; shift;;    --expect-failure|--color-tests|--enable-hard-errors) shift;;    --) shift; break;;     *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;  esac  shiftdoneecho logloglog > $log_filecp $1 $trs_fileENDchmod a+x dummy-driver# Do this in a subroutine to avoid quoting problem in the backticked# command substitution below.get_escaped_line(){   sed -e 's,[$^/\\\.],\\&,g' -e 1q "$@"}have_result (){   cat > exp; echo >> exp; echo logloglog >> exp   eline=$(get_escaped_line exp)   sed -n -e "/^$eline$/,/^logloglog$/p" test-suite.log > got   cat exp; cat got   diff exp got}$ACLOCAL$AUTOCONF$AUTOMAKE./configure: Basic checks.echo :global-test-result: PASS > foo.testecho :global-test-result: ERROR > zar-doz.x$MAKE checkcat test-suite.loghave_result <<ENDPASS: foo=========ENDhave_result <<ENDERROR: zar-doz==============END: Try usage documented in the manual.echo :global-test-result: PASS/SKIP > foo.testecho :global-test-result: ALMOST PASSED > zar-doz.x$MAKE checkcat test-suite.loghave_result <<ENDPASS/SKIP: foo==============ENDhave_result <<ENDALMOST PASSED: zar-doz======================END: Fields ':test-result:' does not interfere with the global test result.cat > foo.test << 'END':test-result: FAIL:global-test-result: PASS:test-result: ERRORENDcat > zar-doz.x << 'END':global-test-result: FAIL:test-result: SKIP:test-result: XFAILEND$MAKE check && exit 1cat test-suite.loghave_result <<ENDPASS: foo=========ENDhave_result <<ENDFAIL: zar-doz=============END: What happens when ':global-test-result:' is absent.cat > foo.test << 'END':test-result: PASS:test-result: ERROREND: > zar-doz.x$MAKE check && exit 1cat test-suite.loghave_result <<ENDRUN: foo========ENDhave_result <<ENDRUN: zar-doz============END# Leading and trailing whitespace gets eaten/normalized.echo ":global-test-result:SKIP${tab}   ${tab}${tab}" > foo.testecho ":global-test-result:${tab}   ${tab}XFAIL  ${tab}   " > zar-doz.x$MAKE checkcat test-suite.loghave_result <<ENDSKIP: foo=========ENDhave_result <<ENDXFAIL: zar-doz==============END# Whitespaces before and after ':global-test-result:' are handled OK.echo "   $tab:global-test-result:PASS" > foo.testecho "${tab}${tab}:global-test-result:${tab}   ${tab}SKIP" > zar-doz.x$MAKE checkcat test-suite.loghave_result <<ENDPASS: foo=========ENDhave_result <<ENDSKIP: zar-doz=============END:
 |