From: Karl Berry Date: Fri, 6 Oct 2023 15:28:19 +0000 (-0700) Subject: tests: add test for new posix option. X-Git-Tag: v1.16i~30 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=b2d0fee3dd00906805cf97a6de21fc0fe6dfdc5b;p=thirdparty%2Fautomake.git tests: add test for new posix option. See https://bugs.gnu.org/55025. * t/posixtarget.sh: New test. * t/list-of-tests.mk (handwritten_tests): Add it. * t/README: mention using existing tests as a basis. --- diff --git a/t/README b/t/README index 16096ca7b..4772c0be2 100644 --- a/t/README +++ b/t/README @@ -1,10 +1,8 @@ The Automake test suite - User interface ============== - Running the tests ----------------- @@ -117,10 +115,18 @@ Reporting failures Writing test cases ================== +* See also summary information in the top-level HACKING file. + * If you plan to fix a bug, write the test case first. This way you'll make sure the test catches the bug, and that it succeeds once you have fixed the bug. +* Sometimes it is better to add to an existing test than to write a new one. + In any case, it is good to look for existing tests checking for + something related, and use one or more them as a starting point. + The posixtarget test is a nearly-minimal test if you end up starting + from scratch. + * Add a copyright/license paragraph. * Explain what the test does, i.e., which features it checks, which @@ -142,8 +148,7 @@ Writing test cases tools which can be taken for granted because they're listed in the GNU Coding Standards (for example, 'gzip'). -* Include 'test-init.sh' in every test script (see existing tests for - examples of how to do this). +* Include 'test-init.sh' in every test script. * Use the 'skip_' function to skip tests, with a meaningful message if possible. Where convenient, use the 'warn_' function to print generic diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index 94781d9b0..5c118b52d 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -872,6 +872,7 @@ t/pluseq8.sh \ t/pluseq9.sh \ t/pluseq10.sh \ t/pluseq11.sh \ +t/posixtarget.sh \ t/posixsubst-data.sh \ t/posixsubst-extradist.sh \ t/posixsubst-ldadd.sh \ diff --git a/t/posixtarget.sh b/t/posixtarget.sh new file mode 100644 index 000000000..ffe7abd54 --- /dev/null +++ b/t/posixtarget.sh @@ -0,0 +1,43 @@ +#! /bin/sh +# Copyright (C) 2023 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Check that the posix option is supported. See https://bugs.gnu.org/55025. + +. test-init.sh + +cat > configure.ac << 'END' +AC_INIT([posixtest], [0.0]) +AM_INIT_AUTOMAKE([posix foreign]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +# Some comment. +random-target: +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +# .POSIX should be the first non-blank non-comment line. +sed -e '/^$/d' -e '/^ *#/d' -e 1q | grep '^\.POSIX:' Makefile.in + +./configure +# Although we aren't responsible for what autoconf does, check that the +# result is as expected, since we're here. +sed -e '/^$/d' -e '/^ *#/d' -e 1q | grep '^\.POSIX:' Makefile