diff options
author | rillig <rillig@pkgsrc.org> | 2005-11-19 21:27:06 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2005-11-19 21:27:06 +0000 |
commit | 4ef5f9827ccd1e0123475d1a8b03b19ec098c6cc (patch) | |
tree | f937cb2b4d7b0aff99822bc4376c1a43a6cabff4 /regress | |
parent | 49d9b553d2846b8737ec21a7662f4ee59c612607 (diff) | |
download | pkgsrc-4ef5f9827ccd1e0123475d1a8b03b19ec098c6cc.tar.gz |
Regression test for the capabilities of the TOOLS. Most of them have
many different implementations and are by no way easy to use. This test
collects some assumptions about what the tools must be able to handle.
It is also meant as a guide on using these tools correctly and reliably.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/tools/Makefile | 22 | ||||
-rw-r--r-- | regress/tools/files/awk-test.sh | 23 | ||||
-rw-r--r-- | regress/tools/spec | 8 |
3 files changed, 53 insertions, 0 deletions
diff --git a/regress/tools/Makefile b/regress/tools/Makefile new file mode 100644 index 00000000000..40f247b462f --- /dev/null +++ b/regress/tools/Makefile @@ -0,0 +1,22 @@ +# $NetBSD: Makefile,v 1.1.1.1 2005/11/19 21:27:06 rillig Exp $ +# + +DISTNAME= regress-tools-1.0 +CATEGORIES= regress +DISTFILES= # empty + +MAINTAINER= rillig@NetBSD.org +COMMENT= Test whether the TOOLS do what I expect + +WRKSRC= ${WRKDIR} +REGRESS_TESTS= awk +USE_TOOLS+= awk + +do-build: +.for t in ${REGRESS_TESTS} + @${_PKG_SILENT}${_PKG_DEBUG}set -e; cd ${WRKSRC:Q}; \ + ${ECHO_MSG} "Running testcase "${t:Q}; \ + ${SH} ${FILESDIR:Q}/${t:Q}-test.sh +.endfor + +.include "../../mk/bsd.pkg.mk" diff --git a/regress/tools/files/awk-test.sh b/regress/tools/files/awk-test.sh new file mode 100644 index 00000000000..b94f38e1c0d --- /dev/null +++ b/regress/tools/files/awk-test.sh @@ -0,0 +1,23 @@ +#! /bin/sh +# $NetBSD: awk-test.sh,v 1.1.1.1 2005/11/19 21:27:06 rillig Exp $ +# + +set -e + +assert_equal() { + case $1 in + "$2") ;; + *) echo "[assert_equal] expected \"$1\", got \"$2\"." 1>&2 + exit 1;; + esac +} + +# usage: test_assignment <input> <expected-output> +test_assignment() { + o=`echo "" | awk '{print var}' var="$1"` + assert_equal "$2" "${o}" +} + +test_assignment "foo" "foo" +test_assignment "foo bar baz" "foo bar baz" +test_assignment "CPPFLAGS=\\\"-Dfoo=bar\\\"" "CPPFLAGS=\"-Dfoo=bar\"" diff --git a/regress/tools/spec b/regress/tools/spec new file mode 100644 index 00000000000..875fa4bf4fd --- /dev/null +++ b/regress/tools/spec @@ -0,0 +1,8 @@ +# $NetBSD: spec,v 1.1.1.1 2005/11/19 21:27:06 rillig Exp $ +# + +MAKEARGS_CLEAN="clean" + +check_result() { + exit_status 0 +} |