pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/regress Added regression test for portability checks.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/623f8f301572
branches:  trunk
changeset: 348254:623f8f301572
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Jun 11 10:48:28 2016 +0000

description:
Added regression test for portability checks.

diffstat:

 regress/Makefile                                      |   3 +-
 regress/check-portability/Makefile                    |  15 ++++++++++
 regress/check-portability/files/portability-ok        |   7 +++++
 regress/check-portability/files/portability-test-eqeq |   7 +++++
 regress/check-portability/spec                        |  26 +++++++++++++++++++
 5 files changed, 57 insertions(+), 1 deletions(-)

diffs (88 lines):

diff -r 1b290683b0f1 -r 623f8f301572 regress/Makefile
--- a/regress/Makefile  Sat Jun 11 10:31:06 2016 +0000
+++ b/regress/Makefile  Sat Jun 11 10:48:28 2016 +0000
@@ -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+=       buildlink-libtool
 SUBDIR+=       buildlink-transform
 SUBDIR+=       buildlink-unwrap
+SUBDIR+=       check-portability
 SUBDIR+=       compiler
 SUBDIR+=       ignore-tools
 SUBDIR+=       make-env-phases
diff -r 1b290683b0f1 -r 623f8f301572 regress/check-portability/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/check-portability/Makefile        Sat Jun 11 10:48:28 2016 +0000
@@ -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@localhost
+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 -r 1b290683b0f1 -r 623f8f301572 regress/check-portability/files/portability-ok
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/check-portability/files/portability-ok    Sat Jun 11 10:48:28 2016 +0000
@@ -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 -r 1b290683b0f1 -r 623f8f301572 regress/check-portability/files/portability-test-eqeq
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/check-portability/files/portability-test-eqeq     Sat Jun 11 10:48:28 2016 +0000
@@ -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 -r 1b290683b0f1 -r 623f8f301572 regress/check-portability/spec
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/check-portability/spec    Sat Jun 11 10:48:28 2016 +0000
@@ -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"
+}



Home | Main Index | Thread Index | Old Index