summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2020-05-05 05:55:25 +0000
committerrillig <rillig@pkgsrc.org>2020-05-05 05:55:25 +0000
commit7c9b7a9a640892a837a4969f3c88afd107c017a3 (patch)
tree52c198d29b8f99755e597f4ec779278959bfd25b /regress
parente719ed11d7206b19e414cd07680201ed23f8113c (diff)
downloadpkgsrc-7c9b7a9a640892a837a4969f3c88afd107c017a3.tar.gz
mk/check/check-portability: opt-in for newer portability checks
There are a few portability checks that have been existing for years. Later additions need an opt-in phase to avoid breaking existing usages. https://mail-index.netbsd.org/tech-pkg/2020/05/04/msg023084.html
Diffstat (limited to 'regress')
-rw-r--r--regress/infra-unittests/check-portability.sh31
1 files changed, 25 insertions, 6 deletions
diff --git a/regress/infra-unittests/check-portability.sh b/regress/infra-unittests/check-portability.sh
index c301a81ecf6..617cacde80a 100644
--- a/regress/infra-unittests/check-portability.sh
+++ b/regress/infra-unittests/check-portability.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# $NetBSD: check-portability.sh,v 1.2 2020/05/04 21:48:18 rillig Exp $
+# $NetBSD: check-portability.sh,v 1.3 2020/05/05 05:55:25 rillig Exp $
#
# Test cases for mk/check/check-portability.*.
#
@@ -12,6 +12,7 @@ set -eu
check_portability_sh() {
env PATCHDIR='patches' \
PREFIX='/nonexistent' \
+ "$@" \
sh "$pkgsrcdir/mk/check/check-portability.sh" \
1>"$tmpdir/out" 2>&1 \
&& exitcode=0 || exitcode=$?
@@ -109,7 +110,8 @@ if test_case_begin 'configure patched, configure.in bad'; then
create_file_lines 'work/configure.in' \
'test a == b'
- check_portability_sh
+ check_portability_sh \
+ 'CHECK_PORTABILITY_EXPERIMENTAL=yes'
assert_that "out" --file-is-empty
assert_that $exitcode --equals 0
@@ -126,7 +128,8 @@ if test_case_begin 'configure patched and still bad'; then
'#! /bin/sh' \
'test a == b'
- check_portability_sh
+ check_portability_sh \
+ 'CHECK_PORTABILITY_EXPERIMENTAL=yes'
create_file 'expected' <<'EOF'
ERROR: [check-portability.awk] => Found test ... == ...:
@@ -159,8 +162,8 @@ fi
if test_case_begin 'special characters in filenames'; then
- # Ensure that the filename matching does not treat special
- # characters as shell commands.
+ # Ensure that the filename matching for patched files
+ # does not treat special characters as shell metacharacters.
create_file_lines 'work/patches/patch-aa' \
'+++ [[[[(`" 2020-05-04'
@@ -168,7 +171,8 @@ if test_case_begin 'special characters in filenames'; then
'#! /bin/sh' \
'test a = b'
- check_portability_sh
+ check_portability_sh \
+ 'CHECK_PORTABILITY_EXPERIMENTAL=yes'
assert_that 'out' --file-is-empty
assert_that $exitcode --equals 0
@@ -193,3 +197,18 @@ if test_case_begin 'no patches'; then
test_case_end
fi
+
+
+if test_case_begin 'no experimental by default'; then
+
+ create_file_lines 'configure.in' \
+ 'test a == b'
+
+ check_portability_sh \
+ 'CHECK_PORTABILITY_EXPERIMENTAL=no'
+
+ assert_that 'out' --file-is-empty
+ assert_that $exitcode --equals 0
+
+ test_case_end
+fi