diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-10-27 15:38:46 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2012-10-27 16:01:19 +0200 |
commit | 44d202536a5fd0ac670eef7f43326093c8c9bc5b (patch) | |
tree | 0cea30165b6523517456fc2b8861a29ee44cdc0e /t/built-sources-fork-bomb.sh | |
parent | 7a3e5c7c58d5f3dab27776b5b07e3d4e1b2e5fdd (diff) | |
download | automake-44d202536a5fd0ac670eef7f43326093c8c9bc5b.tar.gz |
tests: move coverage about BUILT_SOURCES
Basically a backport of some tests from Automake-NG.
* t/built-sources-check.sh: Sync it with the version in the ng/master
branch. Accordingly, move part of the checks out ...
* t/built-sources-install.sh: ... into this new test, synced from
ng/master as well.
* t/built-sources-subdir.sh: Minor tweaks and enhancements to sync it
with the version in ng/master.
* t/built-sources-cond.sh: New test, synced from ng/master.
* t/built-sources.sh: Likewise, with minor edits to avoid a spurious
failure.
* t/built-sources-fork-bomb.sh: Likewise.
* t/list-of-tests.mk: Update.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 't/built-sources-fork-bomb.sh')
-rwxr-xr-x | t/built-sources-fork-bomb.sh | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/t/built-sources-fork-bomb.sh b/t/built-sources-fork-bomb.sh new file mode 100755 index 000000000..fac37505f --- /dev/null +++ b/t/built-sources-fork-bomb.sh @@ -0,0 +1,70 @@ +#! /bin/sh +# Copyright (C) 2012 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 <http://www.gnu.org/licenses/>. + +# Due to how the handling of $(BUILT_SOURCES) is implemented in Automake-NG, +# a recursive make call in the recipe of any $(BUILT_SOURCES) (or of any of +# its prerequisites) might cause an infinite recursion (complete with fork +# bomb, yuck) if not handled correctly. Verify that this doesn't happen. +# For more background, see: +# <http://lists.gnu.org/archive/html/help-smalltalk/2012-08/msg00027.html> +# <http://lists.gnu.org/archive/html/automake-patches/2012-08/msg00052.html> +# Backported to improve coverage of mainline Automake. + +required=GNUmake +. ./defs || exit 1 + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am << 'END' +BUILT_SOURCES = foo +.PHONY: build-foo +build-foo: + echo OK > foo +foo: + $(MAKE) build-foo + +# If the bug is still present, we want this test to fail, not to actually +# go fork bomb and potentially crash the user machine. Take care of that. + +is_too_deep := $(shell test $(MAKELEVEL) -lt 10 && echo no) + +## Extra indentation here required to avoid confusing Automake. + ifeq ($(is_too_deep),no) + # All is ok. + else + $(error ::OOPS:: Recursion too deep, $(MAKELEVEL) levels) + endif +END + +$ACLOCAL +$AUTOMAKE -Wno-portability +$AUTOCONF + +./configure + +$MAKE -n foo >output 2>&1 || { cat output; exit 1; } +cat output +test ! -f foo +# Guard against possible infinite recursion. +$FGREP '::OOPS::' output && exit 1 + +$MAKE foo >output 2>&1 || { cat output; exit 1; } +cat output +$MAKE foo +# Guard against possible infinite recursion. +$FGREP '::OOPS::' output && exit 1 + +: |