diff options
-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 +} |