diff options
author | rillig <rillig@pkgsrc.org> | 2006-07-10 12:44:19 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2006-07-10 12:44:19 +0000 |
commit | 9082445842be3b6a3ad8f84f69157cf3bc1a7d16 (patch) | |
tree | 0b01d6fa0d60f8b853d9dd698e24950a5a660512 /pkgtools/pkg_regress | |
parent | 64895dc026db23e22d0fb035f40518bb7ed4d893 (diff) | |
download | pkgsrc-9082445842be3b6a3ad8f84f69157cf3bc1a7d16.tar.gz |
Updated pkg_regress to 0.2.
Changes since 0.1:
- Improved error messages.
- Made the code simpler.
Diffstat (limited to 'pkgtools/pkg_regress')
-rw-r--r-- | pkgtools/pkg_regress/Makefile | 4 | ||||
-rwxr-xr-x | pkgtools/pkg_regress/files/pkg_regress.sh | 60 |
2 files changed, 34 insertions, 30 deletions
diff --git a/pkgtools/pkg_regress/Makefile b/pkgtools/pkg_regress/Makefile index 8f0300d3ad6..404c808034c 100644 --- a/pkgtools/pkg_regress/Makefile +++ b/pkgtools/pkg_regress/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.6 2006/05/09 02:42:43 rillig Exp $ +# $NetBSD: Makefile,v 1.7 2006/07/10 12:44:19 rillig Exp $ -DISTNAME= pkg_regress-0.1 +DISTNAME= pkg_regress-0.2 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkg_regress/files/pkg_regress.sh b/pkgtools/pkg_regress/files/pkg_regress.sh index 00c3b165200..4af6c0c7d87 100755 --- a/pkgtools/pkg_regress/files/pkg_regress.sh +++ b/pkgtools/pkg_regress/files/pkg_regress.sh @@ -1,15 +1,12 @@ -#!@SH@ -e +#! @SH@ # -# $NetBSD: pkg_regress.sh,v 1.3 2005/05/07 15:46:00 gavan Exp $ +# $NetBSD: pkg_regress.sh,v 1.4 2006/07/10 12:44:19 rillig Exp $ # +set -e -if [ -z "$PKGSRCDIR" ] -then - PKGSRCDIR=@PKGSRCDIR@ -fi - -TEST_EGREP="@EGREP@" -TEST_MAKE="@MAKE@" +: ${PKGSRCDIR="@PKGSRCDIR@"} +: ${TEST_EGREP="@EGREP@"} +: ${TEST_MAKE="@MAKE@"} # hooks overridable by test spec file @@ -45,38 +42,45 @@ check_result() return } +# +# Internal helper routines +# + +# regress_fail <msg> +regress_fail() { + + echo "ERROR: $*" 1>&2 + TEST_RESULT=1 +} + # result checking routines +# Test exit status exit_status() { - # Test exit status - if [ "$1" -ne "${TEST_EXITSTATUS}" ] - then - TEST_RESULT=1 - fi + + [ "$1" -eq "${TEST_EXITSTATUS}" ] \ + || regress_fail "Expected exit code $1, but got ${TEST_EXITSTATUS}." } +# Test positive match against output output_require() { - # Test positive match against output - for PATTERN in "$@" - do - if ! ${TEST_EGREP} -q "${PATTERN}" <${TEST_OUTFILE} >/dev/null - then - TEST_RESULT=1 - fi + + for re in "$@"; do + ${TEST_EGREP} "${re}" < ${TEST_OUTFILE} >/dev/null \ + || regress_fail "Expected \"${re}\" in the output, but it is not there." done } +# Test negative match against output output_prohibit() { - # Test negative match against output - for PATTERN in "$@" - do - if ${TEST_EGREP} -q "${PATTERN}" <${TEST_OUTFILE} >/dev/null - then - TEST_RESULT=1 - fi + + for re in "$@"; do + if ${TEST_EGREP} "${re}" < ${TEST_OUTFILE} >/dev/null; then + regress_fail "Didn't expect \"${re}\" in the output, but found it." + fi done } |