]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: add test for new posix option.
authorKarl Berry <karl@freefriends.org>
Fri, 6 Oct 2023 15:28:19 +0000 (08:28 -0700)
committerKarl Berry <karl@freefriends.org>
Fri, 6 Oct 2023 15:28:19 +0000 (08:28 -0700)
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.

t/README
t/list-of-tests.mk
t/posixtarget.sh [new file with mode: 0644]

index 16096ca7bda8b7bdbe809bacb5e4c23e8f214298..4772c0be2bae849fb5866ab2e1f5a4eeb45448ec 100644 (file)
--- 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
index 94781d9b08e1ce9e33e425f84db8661fc9111b23..5c118b52da81679486c33105fcd550f0daabb500 100644 (file)
@@ -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 (file)
index 0000000..ffe7abd
--- /dev/null
@@ -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 <https://www.gnu.org/licenses/>.
+
+# 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