Tue May 5 06:11:29 2020 UTC ()
regress/infra-unittests: add tests for portability checks

Files like Makefile.am and configure.ac are usually not used during a
build, therefore there's no point in checking these for shell portability
issues.


(rillig)
diff -r1.3 -r1.4 pkgsrc/regress/infra-unittests/check-portability.sh

cvs diff -r1.3 -r1.4 pkgsrc/regress/infra-unittests/check-portability.sh (expand / switch to context diff)
--- pkgsrc/regress/infra-unittests/check-portability.sh 2020/05/05 05:55:25 1.3
+++ pkgsrc/regress/infra-unittests/check-portability.sh 2020/05/05 06:11:29 1.4
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: check-portability.sh,v 1.3 2020/05/05 05:55:25 rillig Exp $
+# $NetBSD: check-portability.sh,v 1.4 2020/05/05 06:11:29 rillig Exp $
 #
 # Test cases for mk/check/check-portability.*.
 #
@@ -108,6 +108,49 @@
 		'#! /bin/sh' \
 		'good'
 	create_file_lines 'work/configure.in' \
+		'test a == b'
+
+	check_portability_sh \
+		'CHECK_PORTABILITY_EXPERIMENTAL=yes'
+
+	assert_that "out" --file-is-empty
+	assert_that $exitcode --equals 0
+
+	test_case_end
+fi
+
+
+if test_case_begin 'Makefile.in patched, Makefile.am bad'; then
+
+	# As of 2020-05-05, Makefile.am is not checked at all since only
+	# very few packages actually use that file during the build.
+
+	create_file_lines 'work/patches/patch-aa' \
+		'+++ Makefile.in 2020-05-05'
+	create_file_lines 'work/Makefile.in' \
+		'test a = b'
+	create_file_lines 'work/Makefile.am' \
+		'test a == b'
+
+	check_portability_sh \
+		'CHECK_PORTABILITY_EXPERIMENTAL=yes'
+
+	assert_that "out" --file-is-empty
+	assert_that $exitcode --equals 0
+
+	test_case_end
+fi
+
+
+if test_case_begin 'files that are usually not used for building'; then
+
+	# The following files are mostly interesting to the upstream
+	# developers and are not used during the actual build, except
+	# if the package rebuilds everything using the GNU autotools.
+
+	create_file_lines 'work/configure.ac' \
+		'test a == b'
+	create_file_lines 'work/Makefile.am' \
 		'test a == b'
 
 	check_portability_sh \