Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified)) by mollari.NetBSD.org (Postfix) with ESMTPS id C5D7B1A9217 for ; Mon, 4 Jan 2021 21:07:33 +0000 (UTC) Received: by mail.netbsd.org (Postfix, from userid 605) id 5DDCF84D5D; Mon, 4 Jan 2021 21:07:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 9535284C86 for ; Mon, 4 Jan 2021 21:07:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id D2WIM1HXA0I6 for ; Mon, 4 Jan 2021 21:07:32 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 0335184C13 for ; Mon, 4 Jan 2021 21:07:31 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id E54ECFA9D; Mon, 4 Jan 2021 21:07:31 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_160979445112400" MIME-Version: 1.0 Date: Mon, 4 Jan 2021 21:07:31 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/regress/infra-unittests To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20210104210731.E54ECFA9D@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_160979445112400 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Mon Jan 4 21:07:31 UTC 2021 Modified Files: pkgsrc/regress/infra-unittests: check-portability.sh Log Message: regress: add test for portability check in configure~ files To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 pkgsrc/regress/infra-unittests/check-portability.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_160979445112400 Content-Disposition: inline Content-Length: 2564 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/regress/infra-unittests/check-portability.sh diff -u pkgsrc/regress/infra-unittests/check-portability.sh:1.5 pkgsrc/regress/infra-unittests/check-portability.sh:1.6 --- pkgsrc/regress/infra-unittests/check-portability.sh:1.5 Mon May 11 19:13:10 2020 +++ pkgsrc/regress/infra-unittests/check-portability.sh Mon Jan 4 21:07:31 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: check-portability.sh,v 1.5 2020/05/11 19:13:10 rillig Exp $ +# $NetBSD: check-portability.sh,v 1.6 2021/01/04 21:07:31 rillig Exp $ # # Test cases for mk/check/check-portability.*. # @@ -8,7 +8,7 @@ set -eu . "./test.subr" -# Runs the shell program for the given file. +# Runs the shell program for all files in the current directory. check_portability_sh() { env PATCHDIR='patches' \ PREFIX='/nonexistent' \ @@ -245,3 +245,50 @@ if test_case_begin 'no experimental by d test_case_end fi + + +if test_case_begin 'always skip tilde files'; then + + + # Projects that use GNU autoconf 2.70 are reported to include + # backup files like 'configure~' in their distribution, for + # whatever reason. Since these files are not used by pkgsrc, + # they should be ignored. + # + # Since the filename is not one of the well-known ones, the file + # must start with a '#!' line to be actually recognized as a shell + # program. + create_file_lines 'configure~' \ + '#! /bin/sh' \ + 'test a == b' + + check_portability_sh \ + 'CHECK_PORTABILITY_EXPERIMENTAL=no' + + create_file 'expected' <<'EOF' +ERROR: [check-portability.awk] => Found test ... == ...: +ERROR: [check-portability.awk] configure~:2: test a == b + +Explanation: +=========================================================================== +The "test" command, as well as the "[" command, are not required to know +the "==" operator. Only a few implementations like bash and some +versions of ksh support it. + +When you run "test foo == foo" on a platform that does not support the +"==" operator, the result will be "false" instead of "true". This can +lead to unexpected behavior. + +There are two ways to fix this error message. If the file that contains +the "test ==" is needed for building the package, you should create a +patch for it, replacing the "==" operator with "=". If the file is not +needed, add its name to the CHECK_PORTABILITY_SKIP variable in the +package Makefile. +=========================================================================== + +EOF + assert_that "$tmpdir/out" --file-equals 'expected' + assert_that $exitcode --equals 1 + + test_case_end +fi --_----------=_160979445112400--