pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_regress Updated pkg_regress to 0.2.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/495f8bede117
branches:  trunk
changeset: 515882:495f8bede117
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Jul 10 12:44:19 2006 +0000

description:
Updated pkg_regress to 0.2.

Changes since 0.1:
- Improved error messages.
- Made the code simpler.

diffstat:

 pkgtools/pkg_regress/Makefile             |   4 +-
 pkgtools/pkg_regress/files/pkg_regress.sh |  60 ++++++++++++++++--------------
 2 files changed, 34 insertions(+), 30 deletions(-)

diffs (102 lines):

diff -r e6697d1d4e16 -r 495f8bede117 pkgtools/pkg_regress/Makefile
--- a/pkgtools/pkg_regress/Makefile     Mon Jul 10 11:59:09 2006 +0000
+++ b/pkgtools/pkg_regress/Makefile     Mon Jul 10 12:44:19 2006 +0000
@@ -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 -r e6697d1d4e16 -r 495f8bede117 pkgtools/pkg_regress/files/pkg_regress.sh
--- a/pkgtools/pkg_regress/files/pkg_regress.sh Mon Jul 10 11:59:09 2006 +0000
+++ b/pkgtools/pkg_regress/files/pkg_regress.sh Mon Jul 10 12:44:19 2006 +0000
@@ -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 @@
        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
 }
 



Home | Main Index | Thread Index | Old Index