From 53112e36729eb58c3662a3144695b292ba4bfb6d Mon Sep 17 00:00:00 2001 From: rillig Date: Sat, 11 Jun 2016 10:48:28 +0000 Subject: Added regression test for portability checks. --- regress/Makefile | 3 ++- regress/check-portability/Makefile | 15 +++++++++++++ regress/check-portability/files/portability-ok | 7 ++++++ .../check-portability/files/portability-test-eqeq | 7 ++++++ regress/check-portability/spec | 26 ++++++++++++++++++++++ 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 regress/check-portability/Makefile create mode 100644 regress/check-portability/files/portability-ok create mode 100644 regress/check-portability/files/portability-test-eqeq create mode 100644 regress/check-portability/spec (limited to 'regress') 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" +} -- cgit v1.2.3