summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2020-08-18 14:54:24 -0400
committerZack Weinberg <zackw@panix.com>2020-08-18 14:54:24 -0400
commit17a7ec16a7b72a82286034c4e0cccf964a9a8afd (patch)
treede1fdafba5e73c791baf94106c2e56e0a1522d52
parent2f97729b39f00dce1c2f0a1b7332e8459bc89786 (diff)
downloadautoconf-17a7ec16a7b72a82286034c4e0cccf964a9a8afd.tar.gz
Don’t distribute tests/ac*.at.
tests/ac*.at are generated files containing basic test cases for all the public AC_* macros that can be invoked without arguments. They’re generated using a simple awk script, and we already require awk at build time because of automake, so there is no reason to ship them in the tarball. If we don’t ship them in the tarball, we can simplify the logic in tests/local.mk, and avoid writing these files to the source directory in a split build. This should fix a problem with split builds using Solaris’ dmake (see bug #110289). tests/mktests.sh probably doesn’t work right if any of its argument paths have spaces in their names, but that’s a separate issue. * tests/local.mk (tests/mktests.stamp): Don’t change directory or rewrite the contents of $(AUTOCONF_FILES). (TESTSUITE_GENERATED_AT): Remove $(srcdir) prefix. Add tests/acerlang.at (accidentally omitted). (CLEANFILES): Add $(TESTSUITE_GENERATED_AT), mktests.stamp and mktests.tmp. (MAINTAINERCLEANFILES): Don’t set. (EXTRA_DIST): Include only the hand-written .at files, $(TESTSUITE_HAND_AT). * configure.ac: Run AC_PROG_AWK, if for some reason AM_INIT_AUTOMAKE hasn’t done it for us. * tests/mktests.sh: Use $AWK if set in environment. Shell script linting.
-rw-r--r--configure.ac9
-rw-r--r--tests/local.mk44
-rwxr-xr-xtests/mktests.sh29
3 files changed, 41 insertions, 41 deletions
diff --git a/configure.ac b/configure.ac
index e9f0da92..38a8ff95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -201,12 +201,15 @@ AC_SUBST([EMACS], [$TEST_EMACS])
AM_PATH_LISPDIR
-## ------------ ##
-## Grep & sed. ##
-## ------------ ##
+## ---------------- ##
+## Grep, sed, awk. ##
+## ---------------- ##
AC_PROG_GREP
AC_PROG_EGREP
AC_PROG_SED
+# AC_PROG_AWK should have already been performed by AM_INIT_AUTOMAKE.
+# AC_REQUIRE([AC_PROG_AWK]) doesn't work outside of an AC_DEFUN.
+m4_provide_if([AC_PROG_AWK], [], [AC_PROG_AWK])
## ----- ##
diff --git a/tests/local.mk b/tests/local.mk
index ea072613..f55e8c6d 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -20,7 +20,6 @@
# But if you are borrowing from this file for setting up autotest in your
# project, remember to distribute both testsuite and package.m4.
EXTRA_DIST += \
- $(TESTSUITE_AT) \
tests/local.at \
tests/mktests.sh \
tests/atlocal.in \
@@ -88,20 +87,21 @@ $(wrappers): tests/wrapper.in
## ------------ ##
TESTSUITE_GENERATED_AT = \
- $(srcdir)/tests/aclang.at \
- $(srcdir)/tests/acc.at \
- $(srcdir)/tests/acfortran.at \
- $(srcdir)/tests/acgo.at \
- $(srcdir)/tests/acgeneral.at \
- $(srcdir)/tests/acstatus.at \
- $(srcdir)/tests/acautoheader.at \
- $(srcdir)/tests/acautoupdate.at \
- $(srcdir)/tests/acspecific.at \
- $(srcdir)/tests/acfunctions.at \
- $(srcdir)/tests/acheaders.at \
- $(srcdir)/tests/actypes.at \
- $(srcdir)/tests/aclibs.at \
- $(srcdir)/tests/acprograms.at
+ tests/aclang.at \
+ tests/acc.at \
+ tests/acerlang.at \
+ tests/acfortran.at \
+ tests/acgo.at \
+ tests/acgeneral.at \
+ tests/acstatus.at \
+ tests/acautoheader.at \
+ tests/acautoupdate.at \
+ tests/acspecific.at \
+ tests/acfunctions.at \
+ tests/acheaders.at \
+ tests/actypes.at \
+ tests/aclibs.at \
+ tests/acprograms.at
TESTSUITE_HAND_AT = \
tests/suite.at \
@@ -120,6 +120,9 @@ TESTSUITE_HAND_AT = \
tests/autoscan.at \
tests/foreign.at
+CLEANFILES += $(TESTSUITE_GENERATED_AT)
+EXTRA_DIST += $(TESTSUITE_HAND_AT)
+
TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT)
TESTSUITE = tests/testsuite
@@ -172,8 +175,7 @@ MAINTAINERCLEANFILES += $(TESTSUITE_GENERATED_AT)
## Producing the test files.
# The files which contain macros we check for syntax. Use $(srcdir)
-# for the benefit of non-GNU make. Fix the names in the rule below
-# where we 'cd' to $srcdir.
+# for the benefit of non-GNU make.
autoconfdir = $(srcdir)/lib/autoconf
AUTOCONF_FILES = $(autoconfdir)/general.m4 \
$(autoconfdir)/status.m4 \
@@ -201,14 +203,10 @@ $(TESTSUITE_GENERATED_AT): tests/mktests.stamp
tests/mktests.stamp : tests/mktests.sh $(AUTOCONF_FILES)
@rm -f tests/mktests.tmp
@touch tests/mktests.tmp
- cd $(srcdir) && $(SHELL) tests/mktests.sh \
- `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, lib/autoconf/,g'`
+ $(SHELL) $(srcdir)/tests/mktests.sh $(AUTOCONF_FILES)
@mv -f tests/mktests.tmp $@
-## Distribute the stamp file, since we distribute the generated files.
-EXTRA_DIST += tests/mktests.stamp
-CLEANFILES += tests/mktests.tmp
-MAINTAINERCLEANFILES += tests/mktests.stamp
+CLEANFILES += tests/mktests.tmp tests/mktests.stamp
## maintainer-check ##
diff --git a/tests/mktests.sh b/tests/mktests.sh
index de3d4540..37b97b2a 100755
--- a/tests/mktests.sh
+++ b/tests/mktests.sh
@@ -17,6 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
+# Set locale to C so that `sort' behaves in a uniform way.
+LANGUAGE=C; export LANGUAGE
+LANG=C; export LANG
+LC_ALL=C; export LC_ALL
+
+# Default AWK.
+: ${AWK=awk}
+
# If we fail, clean up, but touch the output files. We probably failed
# because we used some non-portable tool.
@@ -36,23 +44,14 @@ trap 'echo "'"$as_me"': failed." >&2
# If ever something goes wrong, fail, so that the trap is launched.
set -e
-# We need arguments.
-test $# != 0
-
-# We need these arguments.
-src="$@"
-
-# Set locale to C so that `sort' behaves in a uniform way.
-LANGUAGE=C; export LANGUAGE
-LANG=C; export LANG
-LC_ALL=C export LC_ALL
-
+# We expect a list of autoconf source files as arguments.
+test $# -gt 0
# requires
# --------
# Get the list of macros that are required: there is little interest
# in testing them since they will be run by the guy who requires them.
-sed -n 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' $src |
+sed -n 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' "$@" |
sort -u >$requires
@@ -182,7 +181,7 @@ au_exclude_script="$exclude_list $au_exclude_list {print}"
## Creating the test files. ##
## ------------------------- ##
-for file in $src
+for file in "$@"
do
base=`echo "$file" | sed 's|.*[\\/]||;s|\..*||'`
acbase=$outdir/ac$base
@@ -190,12 +189,12 @@ do
# Get rid of the macros we are not interested in.
sed -n -e 's/^AC_DEFUN(\[*\([a-zA-Z0-9_]*\).*$/\1/p' \
-e 's/^AC_DEFUN_ONCE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' $file |
- awk "$ac_exclude_script" |
+ $AWK "$ac_exclude_script" |
sort -u >$acdefuns
# Get the list of macros which are defined in Autoupdate level.
sed -n 's/^AU_DEFUN(\[*\([a-zA-Z][a-zA-Z0-9_]*\).*$/\1/p' $file |
- awk "$au_exclude_script" |
+ $AWK "$au_exclude_script" |
sort -u >$audefuns
# Filter out required macros.