From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id C00911F4B4 for ; Sun, 17 Jan 2021 08:25:50 +0000 (UTC) Received: from localhost ([::1]:60880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l13Nd-0005cU-FV for normalperson@yhbt.net; Sun, 17 Jan 2021 03:25:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l13NU-0005bC-8s for bug-gnulib@gnu.org; Sun, 17 Jan 2021 03:25:40 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.22]:27500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l13NQ-0006jE-Et for bug-gnulib@gnu.org; Sun, 17 Jan 2021 03:25:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1610871934; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:From:Subject:Sender; bh=APhhcXInXKAKJPgfyoCe02pPuV/wYtV8W8QCUbUM3xw=; b=f2/rOsbFOnIKSXcjsS8iMIkL/p0wFTrJNDs6W0fUZhOKerKq6ozmqJK5k3GEyw+OI3 O1oCFG5NCgEo0qfgoOQoiAsVdbzmhTeHSjGzjXbjqWktS9MhcKyH7Exefl7Y4+R/Yy6X aUp3+HBe5cqgPYtXe98RzxYLzWa2xpvYrG82ZwyK3rigrSjCE42aiuLcENvFODZRXfGo 22vyFNPkguDjLszlL08bLfyuU/NVDiHyLWUR98CqsQUQuiC7q5tD2S2kvffXrpdbqrQN JszGCIpvWRwrgj9yJaU5GgTzNcMjYjcLUfuaoolJxWsgv/ZFQnwIxsnAWfq4F17TyKf8 pZHQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOHqfyyvs=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 47.12.1 DYNA|AUTH) with ESMTPSA id u0aa20x0H8PXqOw (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Sun, 17 Jan 2021 09:25:33 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: argp tests: Avoid test failures on Alpine Linux Date: Sun, 17 Jan 2021 09:25:33 +0100 Message-ID: <4060611.vzazAOvEOD@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=85.215.255.22; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" On Alpine Linux 3.12, 3.13, I see these test failures: FAIL: test-argp-2.sh FAIL: test-argp-version-etc-1.sh They are caused by a 'diff' program that is not POSIX compliant: it produces unified diffs always and does not accept a '-c' nor a '-u' option. diff: unrecognized option: c BusyBox v1.32.1 () multi-call binary. Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2 This patch works around it, by using the 'compare' shell function from init.sh. 2021-01-17 Bruno Haible argp tests: Avoid test failures on Alpine Linux. * tests/test-argp-2.sh: Use the test framework (init.sh). Use the 'compare' function instead of 'diff -c'. * tests/test-argp-version-etc-1.sh: Likewise. diff --git a/tests/test-argp-2.sh b/tests/test-argp-2.sh index 9388c01..4a33fac 100755 --- a/tests/test-argp-2.sh +++ b/tests/test-argp-2.sh @@ -16,46 +16,48 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . */ -TMP=argp.$$ +. "${srcdir=.}/init.sh"; path_prepend_ . -unset ARGP_HELP_FMT ERR=0 +unset ARGP_HELP_FMT + func_compare() { # If argp was compiled without base_name, it will display full program name. # If run on mingw, it will display the program name with a .exe suffix. sed '1{ s,: [^ ]*/test-argp,: test-argp, s,: test-argp\.exe,: test-argp, - }' | LC_ALL=C tr -d '\r' | diff -c $TMP - + }' | LC_ALL=C tr -d '\r' > out + compare expected out } #### # Test --usage output -cat > $TMP < expected < $TMP < expected <$TMP <expected <. EOT # Compare --help output, but filter out any bug-reporting email address. -${CHECKER} ./test-argp${EXEEXT} --help \ +${CHECKER} test-argp${EXEEXT} --help \ | sed 's/^\(Report bugs to \)<[^>]*>.$/\1<>./' | func_compare || ERR=1 #### # Test ambiguous option handling -${CHECKER} ./test-argp${EXEEXT} --optio 2>/dev/null && ERR=1 +${CHECKER} test-argp${EXEEXT} --optio 2>/dev/null && ERR=1 #### # Run built-in tests -${CHECKER} ./test-argp${EXEEXT} || ERR=1 - -rm $TMP +${CHECKER} test-argp${EXEEXT} || ERR=1 -exit $ERR +Exit $ERR diff --git a/tests/test-argp-version-etc-1.sh b/tests/test-argp-version-etc-1.sh index 10b51d7..3ac4236 100755 --- a/tests/test-argp-version-etc-1.sh +++ b/tests/test-argp-version-etc-1.sh @@ -16,12 +16,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -TMP=ave-expected.tmp +. "${srcdir=.}/init.sh"; path_prepend_ . + +ERR=0 + LC_ALL=C export LC_ALL -ERR=0 -cat > $TMP < expected <. @@ -31,13 +33,12 @@ There is NO WARRANTY, to the extent permitted by law. Written by Sergey Poznyakoff. EOT -${CHECKER} ./test-argp-version-etc${EXEEXT} --version | +${CHECKER} test-argp-version-etc${EXEEXT} --version | sed '1s/test-argp-version-etc (.*) .*/test-argp-version-etc (PROJECT) VERSION/ /^Packaged by/d 2,3 s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' | - tr -d '\015' | - diff -c $TMP - || ERR=1 + tr -d '\015' > output -rm $TMP +compare expected output || ERR=1 -exit $ERR +Exit $ERR