[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Improve and extend tests `pluseq*.test' (on `+=' support).
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH] Improve and extend tests `pluseq*.test' (on `+=' support). |
Date: |
Tue, 7 Dec 2010 11:42:35 +0100 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
Ping on this? Reference:
<http://lists.gnu.org/archive/html/automake-patches/2010-11/msg00087.html>
In the meantime, I've amended the patch a bit; in particular, I've rebased
it on the latest maint branch, I've removed some useless (I mean *really*
useless) "make distcheck" calls, and I've relaxed some too-picky grepping
checks (which were exposing too much automake internals without any
significant gain).
The updated patch and the squashed-in diffs are attached.
I will wait the customary 72 hours (until friday evening) before pushing.
Regards,
Stefano
diff --git a/ChangeLog b/ChangeLog
index d1f4be2..82582af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,10 +10,10 @@
Makefile.in w.r.t. whitespaces, to avoid depending too much on
automake internals.
* tests/pluseq4.test: Improve testcase description. Make grepping
- of the generated Makefile.in slighty stricter. Extend the test a
+ of the generated Makefile.in slightly stricter. Extend the test a
bit.
* tests/pluseq6.test: Update testcase description. Make grepping
- of the generated Makefile.in slighty stricter. Remove useless
+ of the generated Makefile.in slightly stricter. Remove useless
AC_SUBST from configure.in and useless variable definition from
Makefile.am. Avoid unnecessary use of a temporary variable.
Remove "threatening" comment.
@@ -27,9 +27,7 @@
* tests/pluseq12.test: ... this new test, similar to pluseq8.test,
but using leading tabs in continuation lines.
* tests/pluseq10.test: Prefer running tests from extra rules
- in Makfile.am, rather then grepping `make' output. Also run
- "make distcheck".
- * tests/pluseq11.test: Also run "make distcheck".
+ in Makfile.am, rather then grepping `make' output.
* tests/pluseq-comment.test: New test on `+=' and comments.
* tests/pluseq-comment-bslash.test: Likewise, but xfailing.
* tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
diff --git a/tests/pluseq-comment-bslash.test b/tests/pluseq-comment-bslash.test
index e7e2c63..9cc30ce 100755
--- a/tests/pluseq-comment-bslash.test
+++ b/tests/pluseq-comment-bslash.test
@@ -36,7 +36,6 @@ VAR += bar
.PHONY: test
test:
test x'$(VAR)' = x'foo quux bar'
-check-local: test
END
$ACLOCAL
@@ -49,6 +48,5 @@ $AUTOCONF
./configure
$MAKE test
-$MAKE distcheck
:
diff --git a/tests/pluseq-comment.test b/tests/pluseq-comment.test
index 408aa4c..920512d 100755
--- a/tests/pluseq-comment.test
+++ b/tests/pluseq-comment.test
@@ -34,18 +34,16 @@ VAR += quux
.PHONY: test
test:
test x'$(VAR)' = x'foo bar baz1 baz2 quux'
-check-local: test
END
$ACLOCAL
$AUTOMAKE
-grep '^VAR *=.*#' Makefile.in && Exit 1
grep '^VAR *=.*-bad' Makefile.in && Exit 1
$AUTOCONF
./configure
$MAKE test
-$MAKE distcheck
+
:
diff --git a/tests/pluseq-header-vars.test b/tests/pluseq-header-vars.test
index aaea40e..141c205 100755
--- a/tests/pluseq-header-vars.test
+++ b/tests/pluseq-header-vars.test
@@ -31,7 +31,7 @@ END
$ACLOCAL
$AUTOMAKE
-grep '^pkgdatadir *= *\$(datadir)/@PACKAGE@ foobar zardoz$' Makefile.in
+grep '^pkgdatadir *= *\$(datadir)/@PACKAGE@ foobar zardoz *$' Makefile.in
test `grep '^pkgdatadir *=' Makefile.in | wc -l` -eq 1
:
diff --git a/tests/pluseq.test b/tests/pluseq.test
index bf85ca8..8a07be6 100755
--- a/tests/pluseq.test
+++ b/tests/pluseq.test
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test basic `+=' functionality.
+# Test very basic `+=' functionality.
. ./defs || Exit 1
diff --git a/tests/pluseq10.test b/tests/pluseq10.test
index 28120c0..aa52cdb 100755
--- a/tests/pluseq10.test
+++ b/tests/pluseq10.test
@@ -40,14 +40,16 @@ foo += b0.h \
b1.h
endif
-.PHONY: test
-test:
+.PHONY: test1 test2
+test1:
+ ## The value of $(foo) shouldn't contain any backslash character.
+ case '$(foo)' in *\\*) exit 1;; *) exit 0;; esac
+test2:
## Take care of possible extra whitespaces introduced by automake
- ## when conditionals are involved. These extra spaces must be
- ## considered an an implementation detail, and shouldn't cause
+ ## when conditionals are involved. These extra spaces must
+ ## beconsidered an implementation detail, and shouldn't cause
## spurious testsuite failure.
test x"`echo $(foo)`" = x'0.h a0.h a1.h a2.h a3.h'
-check-local: test
END
$ACLOCAL
@@ -55,6 +57,6 @@ $AUTOCONF
$AUTOMAKE
./configure
-$MAKE test
-$MAKE distcheck
+$MAKE test1 test2
+
:
diff --git a/tests/pluseq11.test b/tests/pluseq11.test
index e691042..12ec4d7 100755
--- a/tests/pluseq11.test
+++ b/tests/pluseq11.test
@@ -40,7 +40,6 @@ FOO += baz
.PHONY: test
test:
case '$(FOO)' in *\\*) exit 1;; *) exit 0;; esac
-check-local: test
END
$ACLOCAL
@@ -51,6 +50,5 @@ grep '^ *FOO *=.*\\.' Makefile.in && Exit 1
$AUTOCONF
./configure
$MAKE test
-$MAKE distcheck
:
diff --git a/tests/pluseq12.test b/tests/pluseq12.test
index 5404c66..4fa6d54 100755
--- a/tests/pluseq12.test
+++ b/tests/pluseq12.test
@@ -35,7 +35,6 @@ VAR += three
.PHONY: test
test:
test x'$(VAR)' = x'one two three'
-check-local: test
END
$ACLOCAL
@@ -44,6 +43,5 @@ $AUTOMAKE
./configure
$MAKE
-$MAKE distcheck
:
diff --git a/tests/pluseq6.test b/tests/pluseq6.test
index d3f8a26..4d23444 100755
--- a/tests/pluseq6.test
+++ b/tests/pluseq6.test
@@ -28,7 +28,7 @@ END
$ACLOCAL
$AUTOMAKE
-grep '^mandir *= address@hidden@ foo$' Makefile.in
+grep '^mandir *= address@hidden@ foo *$' Makefile.in
test `grep '^mandir *=' Makefile.in | wc -l` -eq 1
:
diff --git a/tests/pluseq8.test b/tests/pluseq8.test
index 5f4c23d..2c9e714 100755
--- a/tests/pluseq8.test
+++ b/tests/pluseq8.test
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Another `+=' test w.r.t. line continuations. From Paul Berrevoets.
-# Keep this in sync with sister test `pluseq13.test'.
+# Keep this in sync with sister test `pluseq12.test'.
. ./defs || Exit 1
@@ -35,7 +35,6 @@ VAR += three
.PHONY: test
test:
test x'$(VAR)' = x'one two three'
-check-local: test
END
$ACLOCAL
@@ -44,6 +43,5 @@ $AUTOMAKE
./configure
$MAKE
-$MAKE distcheck
:
From 502a166c486b9294fe8db4c07ea751ffad101e35 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 8 Nov 2010 17:57:08 +0100
Subject: [PATCH] Improve and extend tests `pluseq*.test' (on `+=' support).
* tests/pluseq.test: Enable `errexit' shell flag. Make grepping
of generated Makefile.in stricter.
* tests/pluseq2.test: Also run autoconf, run ./configure with
different values of conditionals, and do deeper tests by running
`make' properly.
* tests/pluseq3.test: Likewise. Also, relax grepping of generated
Makefile.in w.r.t. whitespaces, to avoid depending too much on
automake internals.
* tests/pluseq4.test: Improve testcase description. Make grepping
of the generated Makefile.in slightly stricter. Extend the test a
bit.
* tests/pluseq6.test: Update testcase description. Make grepping
of the generated Makefile.in slightly stricter. Remove useless
AC_SUBST from configure.in and useless variable definition from
Makefile.am. Avoid unnecessary use of a temporary variable.
Remove "threatening" comment.
* tests/pluseq-header-vars.test: New test, taking over the older
role of pluseq6.test.
* tests/pluseq7.test: Make grepping of automake error messages
stricter. Remove "threatening" comment.
* tests/pluseq8.test: Run autoconf, ./configure and make rather
than resorting to an overly complex grepping of Makefile.in.
Add comments telling to keep it in sync with ...
* tests/pluseq12.test: ... this new test, similar to pluseq8.test,
but using leading tabs in continuation lines.
* tests/pluseq10.test: Prefer running tests from extra rules
in Makfile.am, rather then grepping `make' output.
* tests/pluseq-comment.test: New test on `+=' and comments.
* tests/pluseq-comment-bslash.test: Likewise, but xfailing.
* tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
---
ChangeLog | 34 ++++++++++++++++++++++++
tests/Makefile.am | 5 +++
tests/Makefile.in | 5 +++
tests/pluseq-comment-bslash.test | 52 ++++++++++++++++++++++++++++++++++++++
tests/pluseq-comment.test | 49 +++++++++++++++++++++++++++++++++++
tests/pluseq-header-vars.test | 37 +++++++++++++++++++++++++++
tests/pluseq.test | 9 +++++-
tests/pluseq10.test | 17 ++++++++----
tests/pluseq12.test | 47 ++++++++++++++++++++++++++++++++++
tests/pluseq2.test | 20 ++++++++++++++-
tests/pluseq3.test | 26 +++++++++++++++---
tests/pluseq4.test | 8 ++++-
tests/pluseq6.test | 14 +++-------
tests/pluseq7.test | 3 +-
tests/pluseq8.test | 25 +++++++++--------
15 files changed, 311 insertions(+), 40 deletions(-)
create mode 100755 tests/pluseq-comment-bslash.test
create mode 100755 tests/pluseq-comment.test
create mode 100755 tests/pluseq-header-vars.test
create mode 100755 tests/pluseq12.test
diff --git a/ChangeLog b/ChangeLog
index e8864f1..82582af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+2010-12-07 Stefano Lattarini <address@hidden>
+
+ Improve and extend tests `pluseq*.test' (on `+=' support).
+ * tests/pluseq.test: Enable `errexit' shell flag. Make grepping
+ of generated Makefile.in stricter.
+ * tests/pluseq2.test: Also run autoconf, run ./configure with
+ different values of conditionals, and do deeper tests by running
+ `make' properly.
+ * tests/pluseq3.test: Likewise. Also, relax grepping of generated
+ Makefile.in w.r.t. whitespaces, to avoid depending too much on
+ automake internals.
+ * tests/pluseq4.test: Improve testcase description. Make grepping
+ of the generated Makefile.in slightly stricter. Extend the test a
+ bit.
+ * tests/pluseq6.test: Update testcase description. Make grepping
+ of the generated Makefile.in slightly stricter. Remove useless
+ AC_SUBST from configure.in and useless variable definition from
+ Makefile.am. Avoid unnecessary use of a temporary variable.
+ Remove "threatening" comment.
+ * tests/pluseq-header-vars.test: New test, taking over the older
+ role of pluseq6.test.
+ * tests/pluseq7.test: Make grepping of automake error messages
+ stricter. Remove "threatening" comment.
+ * tests/pluseq8.test: Run autoconf, ./configure and make rather
+ than resorting to an overly complex grepping of Makefile.in.
+ Add comments telling to keep it in sync with ...
+ * tests/pluseq12.test: ... this new test, similar to pluseq8.test,
+ but using leading tabs in continuation lines.
+ * tests/pluseq10.test: Prefer running tests from extra rules
+ in Makfile.am, rather then grepping `make' output.
+ * tests/pluseq-comment.test: New test on `+=' and comments.
+ * tests/pluseq-comment-bslash.test: Likewise, but xfailing.
+ * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
2010-11-25 Stefano Lattarini <address@hidden>
Fix spurious failures in `silent*.test' for $CC != gcc
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dab04e3..5569e41 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,6 +21,7 @@ all.test \
auxdir2.test \
cond17.test \
gcj6.test \
+pluseq-comment-bslash.test \
txinfo5.test
include $(srcdir)/parallel-tests.am
@@ -571,6 +572,10 @@ pluseq8.test \
pluseq9.test \
pluseq10.test \
pluseq11.test \
+pluseq12.test \
+pluseq-comment.test \
+pluseq-comment-bslash.test \
+pluseq-header-vars.test \
postproc.test \
ppf77.test \
pr2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index de21f43..3ef62da 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -277,6 +277,7 @@ all.test \
auxdir2.test \
cond17.test \
gcj6.test \
+pluseq-comment-bslash.test \
txinfo5.test
parallel_tests = \
@@ -838,6 +839,10 @@ pluseq8.test \
pluseq9.test \
pluseq10.test \
pluseq11.test \
+pluseq12.test \
+pluseq-comment.test \
+pluseq-comment-bslash.test \
+pluseq-header-vars.test \
postproc.test \
ppf77.test \
pr2.test \
diff --git a/tests/pluseq-comment-bslash.test b/tests/pluseq-comment-bslash.test
new file mode 100755
index 0000000..9cc30ce
--- /dev/null
+++ b/tests/pluseq-comment-bslash.test
@@ -0,0 +1,52 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test for `+=' and comments, when line continuations *in comments*
+# are involved.
+# This test is currently failing; it's not even clear if "fixing"
+# automake to make it pass would be worthwhile.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+VAR = foo
+VAR += quux # \
+zardoz
+VAR += bar
+
+.PHONY: test
+test:
+ test x'$(VAR)' = x'foo quux bar'
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+grep '^VAR *=.*#' Makefile.in && Exit 1
+grep '^VAR *=.*zardoz' Makefile.in && Exit 1
+
+$AUTOCONF
+
+./configure
+$MAKE test
+
+:
diff --git a/tests/pluseq-comment.test b/tests/pluseq-comment.test
new file mode 100755
index 0000000..920512d
--- /dev/null
+++ b/tests/pluseq-comment.test
@@ -0,0 +1,49 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test for += and comments.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+VAR = foo # foo-bad
+VAR += bar # bar-bad
+VAR += baz1 \
+baz2 # baz-bad
+VAR += quux
+
+.PHONY: test
+test:
+ test x'$(VAR)' = x'foo bar baz1 baz2 quux'
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+grep '^VAR *=.*-bad' Makefile.in && Exit 1
+
+$AUTOCONF
+
+./configure
+$MAKE test
+
+:
diff --git a/tests/pluseq-header-vars.test b/tests/pluseq-header-vars.test
new file mode 100755
index 0000000..141c205
--- /dev/null
+++ b/tests/pluseq-header-vars.test
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test that `+=' works with standard header-vars.
+# Please update this test if definition of `pkgdatadir' is modified or
+# removed from `lib/am/header-vars.am'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am << 'END'
+pkgdatadir += foobar
+pkgdatadir += \
+ zardoz
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+grep '^pkgdatadir *= *\$(datadir)/@PACKAGE@ foobar zardoz *$' Makefile.in
+test `grep '^pkgdatadir *=' Makefile.in | wc -l` -eq 1
+
+:
diff --git a/tests/pluseq.test b/tests/pluseq.test
index 66eec8f..8a07be6 100755
--- a/tests/pluseq.test
+++ b/tests/pluseq.test
@@ -14,10 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test `+=' functionality.
+# Test very basic `+=' functionality.
. ./defs || Exit 1
+set -e
+
cat > Makefile.am << 'END'
data_DATA = zar
data_DATA += doz
@@ -25,6 +27,9 @@ END
$ACLOCAL
$AUTOMAKE
-$FGREP 'zar doz' Makefile.in
+
+# Check that the concatenated value hasn't been uselessly split up
+# or extended with extraneous white spaces.
+grep '^data_DATA *= *zar doz$' Makefile.in
:
diff --git a/tests/pluseq10.test b/tests/pluseq10.test
index 9273415..aa52cdb 100755
--- a/tests/pluseq10.test
+++ b/tests/pluseq10.test
@@ -40,9 +40,16 @@ foo += b0.h \
b1.h
endif
-.PHONY: print
-print:
- @echo BEG: $(foo) :END
+.PHONY: test1 test2
+test1:
+ ## The value of $(foo) shouldn't contain any backslash character.
+ case '$(foo)' in *\\*) exit 1;; *) exit 0;; esac
+test2:
+ ## Take care of possible extra whitespaces introduced by automake
+ ## when conditionals are involved. These extra spaces must
+ ## beconsidered an implementation detail, and shouldn't cause
+ ## spurious testsuite failure.
+ test x"`echo $(foo)`" = x'0.h a0.h a1.h a2.h a3.h'
END
$ACLOCAL
@@ -50,8 +57,6 @@ $AUTOCONF
$AUTOMAKE
./configure
-$MAKE print >stdout || { cat stdout; Exit 1; }
-cat stdout
-$FGREP 'BEG: 0.h a0.h a1.h a2.h a3.h :END' stdout
+$MAKE test1 test2
:
diff --git a/tests/pluseq12.test b/tests/pluseq12.test
new file mode 100755
index 0000000..4fa6d54
--- /dev/null
+++ b/tests/pluseq12.test
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Another `+=' test w.r.t. line continuations. From Paul Berrevoets.
+# Keep this in sync with sister test `pluseq8.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+## NOTE: leading tabs in the next lines!
+VAR = \
+ one \
+ two
+VAR += three
+
+.PHONY: test
+test:
+ test x'$(VAR)' = x'one two three'
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE
+
+:
diff --git a/tests/pluseq2.test b/tests/pluseq2.test
index f9db345..710c10e 100755
--- a/tests/pluseq2.test
+++ b/tests/pluseq2.test
@@ -22,7 +22,8 @@
set -e
cat >> configure.in << 'END'
-AM_CONDITIONAL([CHECK], [true])
+AM_CONDITIONAL([CHECK], [test x"$cond_check" = x"yes"])
+AC_OUTPUT
END
cat > Makefile.am << 'END'
@@ -39,11 +40,28 @@ else
data_DATA += dog
endif
+.PHONY: test_CHECK_TRUE test_CHECK_FALSE
+test_CHECK_TRUE:
+ test x'$(data_DATA)' = x'zar doz'
+test_CHECK_FALSE:
+ test x'$(data_DATA)' = x'dog'
+
END
$ACLOCAL
$AUTOMAKE
+
+# Weak grepping checks, for backward-compatibility. Might be
+# removed if automake insternals change.
grep 'CHECK_TRUE.*zar doz' Makefile.in
grep 'CHECK_FALSE.*dog' Makefile.in
+$AUTOCONF
+
+./configure cond_check=yes
+$MAKE test_CHECK_TRUE
+
+./configure cond_check=no
+$MAKE test_CHECK_FALSE
+
:
diff --git a/tests/pluseq3.test b/tests/pluseq3.test
index 755002c..f49892c 100755
--- a/tests/pluseq3.test
+++ b/tests/pluseq3.test
@@ -15,14 +15,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Another `+=' test with conditionals.
+# Test `+=' with conditionals and line wrapping.
. ./defs || Exit 1
set -e
cat >> configure.in << 'END'
-AM_CONDITIONAL([CHECK], [true])
+AM_CONDITIONAL([CHECK], [test x"$cond_check" = x"yes"])
+AC_OUTPUT
END
cat > Makefile.am << 'END'
@@ -40,14 +41,29 @@ else
data_DATA += dog
endif
+.PHONY: test_CHECK_TRUE test_CHECK_FALSE
+test_CHECK_TRUE:
+ test x'$(data_DATA)' =
x'zarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr doz'
+test_CHECK_FALSE:
+ test x'$(data_DATA)' = x'dog'
+
END
$ACLOCAL
$AUTOMAKE
-grep 'address@hidden@data_DATA =
zarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr \\$'
Makefile.in
-grep 'address@hidden@ doz$' Makefile.in
+# Weaker grepping checks, for backward-compatibility. Might need to
+# be adapted if automake insternals are changed.
+grep 'address@hidden@data_DATA *=
*zarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr \\$'
Makefile.in
+grep 'address@hidden@[ ][ ]*doz$' Makefile.in
+grep 'address@hidden@data_DATA *= *dog$' Makefile.in
+
+$AUTOCONF
+
+./configure cond_check=yes
+$MAKE test_CHECK_TRUE
-grep 'address@hidden@data_DATA = dog$' Makefile.in
+./configure cond_check=no
+$MAKE test_CHECK_FALSE
:
diff --git a/tests/pluseq4.test b/tests/pluseq4.test
index 744b489..4ed5b62 100755
--- a/tests/pluseq4.test
+++ b/tests/pluseq4.test
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Yet another `+=' test.
+# Check that we can extend AC_SUBST'd variables using `+='.
. ./defs || Exit 1
@@ -22,15 +22,19 @@ set -e
cat >> configure.in << 'END'
AC_PROG_CC
+AC_SUBST([FOOBAR])
END
cat > Makefile.am << 'END'
bin_PROGRAMS = foo
CC += -Dwhatever
+FOOBAR += zardoz
END
$ACLOCAL
$AUTOMAKE
-$FGREP '@CC@ -Dwhatever' Makefile.in
+
+grep '^CC *= address@hidden@ -Dwhatever *$' Makefile.in
+grep '^FOOBAR *= address@hidden@ zardoz *$' Makefile.in
:
diff --git a/tests/pluseq6.test b/tests/pluseq6.test
index af05239..4d23444 100755
--- a/tests/pluseq6.test
+++ b/tests/pluseq6.test
@@ -14,27 +14,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test that `+=' works with standard header-vars.
+# Test that `+=' works with $(mandir). This test is mostly kept for
+# historical reasons, and to be safe w.r.t. backward compatibility.
. ./defs || Exit 1
set -e
-cat >> configure.in << 'END'
-AC_SUBST([ZZZ])
-END
-
-# If you do this in a real Makefile.am, I will kill you.
cat > Makefile.am << 'END'
mandir += foo
-zq = zzz
END
$ACLOCAL
$AUTOMAKE
-$FGREP '@mandir@ foo' Makefile.in
-num=`grep '^mandir =' Makefile.in | wc -l`
-test $num -eq 1
+grep '^mandir *= address@hidden@ foo *$' Makefile.in
+test `grep '^mandir *=' Makefile.in | wc -l` -eq 1
:
diff --git a/tests/pluseq7.test b/tests/pluseq7.test
index 0716462..6bfefd4 100755
--- a/tests/pluseq7.test
+++ b/tests/pluseq7.test
@@ -26,7 +26,6 @@ AC_PROG_CC
AC_PROG_RANLIB
END
-# If you do this in a real Makefile.am, I will kill you.
cat > Makefile.am << 'END'
lib_LIBRARIES = libq.a
libq_a_SOURCES = q.c
@@ -35,6 +34,6 @@ END
$ACLOCAL
AUTOMAKE_fails
-grep 'Makefile.am:3:.*AR' stderr
+grep '^Makefile\.am:3:.*AR.*must be set.*before.*+=' stderr
:
diff --git a/tests/pluseq8.test b/tests/pluseq8.test
index 901f8b6..2c9e714 100755
--- a/tests/pluseq8.test
+++ b/tests/pluseq8.test
@@ -15,32 +15,33 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Another `+=' test. From Paul Berrevoets.
+# Another `+=' test w.r.t. line continuations. From Paul Berrevoets.
+# Keep this in sync with sister test `pluseq12.test'.
. ./defs || Exit 1
set -e
+cat >>configure.in << 'END'
+AC_OUTPUT
+END
+
cat > Makefile.am << 'END'
VAR = \
one \
two
VAR += three
+
+.PHONY: test
+test:
+ test x'$(VAR)' = x'one two three'
END
$ACLOCAL
+$AUTOCONF
$AUTOMAKE
-sed -n -e '/^VAR =/ {
- :loop
- p
- n
- t clear
- :clear
- s/\\$/\\/
- t loop
- p
- n
- }' Makefile.in | grep three
+./configure
+$MAKE
:
--
1.7.1
- Re: [PATCH] Improve and extend tests `pluseq*.test' (on `+=' support).,
Stefano Lattarini <=