From 671ea05756252f257a596aabe56dcffe247c8a9c Mon Sep 17 00:00:00 2001 From: rillig Date: Sat, 19 Nov 2005 21:27:06 +0000 Subject: 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. --- regress/tools/Makefile | 22 ++++++++++++++++++++++ regress/tools/files/awk-test.sh | 23 +++++++++++++++++++++++ regress/tools/spec | 8 ++++++++ 3 files changed, 53 insertions(+) create mode 100644 regress/tools/Makefile create mode 100644 regress/tools/files/awk-test.sh create mode 100644 regress/tools/spec 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 +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 +} -- cgit v1.2.3