diff options
Diffstat (limited to 'regress/check-portability')
-rw-r--r-- | regress/check-portability/Makefile | 15 | ||||
-rw-r--r-- | regress/check-portability/files/portability-ok | 7 | ||||
-rw-r--r-- | regress/check-portability/files/portability-test-eqeq | 7 | ||||
-rw-r--r-- | regress/check-portability/spec | 26 |
4 files changed, 55 insertions, 0 deletions
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" +} |