summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2016-06-11 10:48:28 +0000
committerrillig <rillig@pkgsrc.org>2016-06-11 10:48:28 +0000
commit9e2f96f47d0fe4b36e50c500376eb319bd08d919 (patch)
tree337f9caaa94a3ce0879d9174d145430d31c47d4f /regress
parent9864f48e607b3cdf3cad937fa90741ac4fd30187 (diff)
downloadpkgsrc-9e2f96f47d0fe4b36e50c500376eb319bd08d919.tar.gz
Added regression test for portability checks.
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile3
-rw-r--r--regress/check-portability/Makefile15
-rw-r--r--regress/check-portability/files/portability-ok7
-rw-r--r--regress/check-portability/files/portability-test-eqeq7
-rw-r--r--regress/check-portability/spec26
5 files changed, 57 insertions, 1 deletions
diff --git a/regress/Makefile b/regress/Makefile
index 5ab9a9f3082..bd89b716fbc 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.17 2007/08/13 08:12:48 rillig Exp $
+# $NetBSD: Makefile,v 1.18 2016/06/11 10:48:28 rillig Exp $
#
COMMENT= Regression tests for pkgsrc infrastructure
@@ -8,6 +8,7 @@ SUBDIR+= bootstrap-install-sh
SUBDIR+= buildlink-libtool
SUBDIR+= buildlink-transform
SUBDIR+= buildlink-unwrap
+SUBDIR+= check-portability
SUBDIR+= compiler
SUBDIR+= ignore-tools
SUBDIR+= make-env-phases
diff --git a/regress/check-portability/Makefile b/regress/check-portability/Makefile
new file mode 100644
index 00000000000..90186e05fe6
--- /dev/null
+++ b/regress/check-portability/Makefile
@@ -0,0 +1,15 @@
+# $NetBSD: Makefile,v 1.1 2016/06/11 10:48:28 rillig Exp $
+
+DISTNAME= check-portability-1.0
+CATEGORIES= regress
+MASTER_SITES= # none
+DISTFILES= # none
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+COMMENT= Tests whether the portability check works as expected
+LICENSE= 2-clause-bsd
+
+PLIST_SRC= # none
+NO_CHECKSUM= yes
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/regress/check-portability/files/portability-ok b/regress/check-portability/files/portability-ok
new file mode 100644
index 00000000000..1ed373616ad
--- /dev/null
+++ b/regress/check-portability/files/portability-ok
@@ -0,0 +1,7 @@
+# $NetBSD: portability-ok,v 1.1 2016/06/11 10:48:28 rillig Exp $
+
+if [ "$var" = value ]; then
+ ...
+elif test "$var" = value ]; then
+ ...
+fi
diff --git a/regress/check-portability/files/portability-test-eqeq b/regress/check-portability/files/portability-test-eqeq
new file mode 100644
index 00000000000..d656a2019f2
--- /dev/null
+++ b/regress/check-portability/files/portability-test-eqeq
@@ -0,0 +1,7 @@
+# $NetBSD: portability-test-eqeq,v 1.1 2016/06/11 10:48:28 rillig Exp $
+
+if [ $HAVE_STDIO_H == yes ]; then
+ ...
+elif test $HAVE_STDLIB_H == yes ]; then
+ ...
+fi
diff --git a/regress/check-portability/spec b/regress/check-portability/spec
new file mode 100644
index 00000000000..f86d8281461
--- /dev/null
+++ b/regress/check-portability/spec
@@ -0,0 +1,26 @@
+#! /bin/sh
+# $NetBSD: spec,v 1.1 2016/06/11 10:48:28 rillig Exp $
+set -eu
+
+check_portability() {
+ env CK_FNAME="$1" \
+ CK_PROGNAME="check-portability.awk" \
+ awk -f "$PKGSRCDIR/mk/check/check-subr.awk" \
+ -f "$PKGSRCDIR/mk/check/check-portability.awk" \
+ "$@"
+
+ # See http://stackoverflow.com/q/4072984
+ echo "result $? for $1"
+}
+
+do_test() {
+ check_portability "files/portability-ok"
+ check_portability "files/portability-test-eqeq"
+} >$TEST_OUTFILE 2>&1
+
+check_result() {
+ output_require "0 for files/portability-ok"
+ output_require "files/portability-test-eqeq: if \["
+ output_require "files/portability-test-eqeq: elif test"
+ output_require "result 1 for files/portability-test-eqeq"
+}