#!/bin/sh # Helper script to run the automake testsuite through the `prove' utility. # See the "prove" and "installprove" targets in tests/Makefile.am. # Copyright (C) 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 . set -u nl=' ' tst=$1 shift case $tst in *.test) echo 1..1 # Protect the output contents of the test script, since it might # sometimes contain TAP lines that would confuse `prove'. This # has already happened in practice, especially for the tests # checking TAP support in automake-generated test harnesses. (${TEST_RUNNER-} "$tst" ${1+"$@"}; echo exit status: $?) 2>&1 | awk ' BEGIN { lastine = "exit status: 255"; } { print " " $0; lastline = $0; } END { st = lastline; sub("^exit status: *", "", st); exit st; } ' st=$? if test $st -eq 99; then echo "not ok - $tst: hard failure (exit status $st)" elif test $st -eq 77; then echo "ok - $tst # SKIP" else case " ${XFAIL_TESTS-} " in *" $tst "*) xs=' # TODO';; *) xs='';; esac if test $st -eq 0; then echo "ok - test script $tst passed$xs" else echo "not ok - test script $tst failed (exit status $st)$xs" fi fi exit 0 ;; *.tap) ${TAP_RUNNER-} "$tst" ${1+"$@"} 2>&1 exit $? ;; esac echo "Bail out! Invalid test script name '$tst'" exit 99