summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorrillig <rillig>2005-11-19 21:27:06 +0000
committerrillig <rillig>2005-11-19 21:27:06 +0000
commit671ea05756252f257a596aabe56dcffe247c8a9c (patch)
treef937cb2b4d7b0aff99822bc4376c1a43a6cabff4 /regress
parent81daa0ea2857d54bb67861b52094ee5da43eef8a (diff)
downloadpkgsrc-671ea05756252f257a596aabe56dcffe247c8a9c.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/Makefile22
-rw-r--r--regress/tools/files/awk-test.sh23
-rw-r--r--regress/tools/spec8
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
+}