Sat Jun 11 10:48:28 2016 UTC ()
Added regression test for portability checks.
(rillig)
diff -r1.17 -r1.18 pkgsrc/regress/Makefile
diff -r0 -r1.1 pkgsrc/regress/check-portability/Makefile
diff -r0 -r1.1 pkgsrc/regress/check-portability/spec
diff -r0 -r1.1 pkgsrc/regress/check-portability/files/portability-ok
diff -r0 -r1.1 pkgsrc/regress/check-portability/files/portability-test-eqeq
--- pkgsrc/regress/Attic/Makefile 2007/08/13 08:12:48 1.17
+++ pkgsrc/regress/Attic/Makefile 2016/06/11 10:48:28 1.18
| @@ -1,21 +1,22 @@ | | | @@ -1,21 +1,22 @@ |
1 | # $NetBSD: Makefile,v 1.17 2007/08/13 08:12:48 rillig Exp $ | | 1 | # $NetBSD: Makefile,v 1.18 2016/06/11 10:48:28 rillig Exp $ |
2 | # | | 2 | # |
3 | | | 3 | |
4 | COMMENT= Regression tests for pkgsrc infrastructure | | 4 | COMMENT= Regression tests for pkgsrc infrastructure |
5 | | | 5 | |
6 | SUBDIR+= barrier | | 6 | SUBDIR+= barrier |
7 | SUBDIR+= bootstrap-install-sh | | 7 | SUBDIR+= bootstrap-install-sh |
8 | SUBDIR+= buildlink-libtool | | 8 | SUBDIR+= buildlink-libtool |
9 | SUBDIR+= buildlink-transform | | 9 | SUBDIR+= buildlink-transform |
10 | SUBDIR+= buildlink-unwrap | | 10 | SUBDIR+= buildlink-unwrap |
| | | 11 | SUBDIR+= check-portability |
11 | SUBDIR+= compiler | | 12 | SUBDIR+= compiler |
12 | SUBDIR+= ignore-tools | | 13 | SUBDIR+= ignore-tools |
13 | SUBDIR+= make-env-phases | | 14 | SUBDIR+= make-env-phases |
14 | SUBDIR+= make-quoting | | 15 | SUBDIR+= make-quoting |
15 | SUBDIR+= pkg-options | | 16 | SUBDIR+= pkg-options |
16 | SUBDIR+= pkgfail | | 17 | SUBDIR+= pkgfail |
17 | SUBDIR+= print-plist | | 18 | SUBDIR+= print-plist |
18 | SUBDIR+= subst | | 19 | SUBDIR+= subst |
19 | SUBDIR+= tools | | 20 | SUBDIR+= tools |
20 | | | 21 | |
21 | .include "../mk/misc/category.mk" | | 22 | .include "../mk/misc/category.mk" |
# $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"
#! /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"
}
# $NetBSD: portability-ok,v 1.1 2016/06/11 10:48:28 rillig Exp $
if [ "$var" = value ]; then
...
elif test "$var" = value ]; then
...
fi
# $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