[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Extend tests/README (trailing `:' in test scripts)
From: |
Stefano Lattarini |
Subject: |
[PATCH] Extend tests/README (trailing `:' in test scripts) |
Date: |
Fri, 11 Jun 2010 12:42:24 +0200 |
User-agent: |
KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; ) |
Hello Ralf.
OK to apply this patch to tests/README? I think the original one has
fallen off your radar (in fact I posted it in quite an inappropriate
place, see below).
For reference:
<http://lists.gnu.org/archive/html/automake-patches/2010-04/msg00102.html>
<http://lists.gnu.org/archive/html/automake-patches/2010-04/msg00103.html>
-*-*-
* tests/README (section "Writing test cases" subsection "Do"):
Explain why apparently redundant trailing `:' and `Exit 0' in
test scripts can indeed be useful.
---
ChangeLog | 8 ++++++++
tests/README | 7 +++++++
2 files changed, 15 insertions(+), 0 deletions(-)
-*-*-
At Monday 26 April 2010, Stefano Lattarini wrote:
> At Monday 26 April 2010, Ralf Wildenhues <address@hidden>
> wrote:
> > * Stefano Lattarini wrote on Mon, Apr 26, 2010 at 12:15:33AM CEST:
> > > --- a/tests/silent6.test
> > > +++ b/tests/silent6.test
> > >
> > > @@ -99,5 +99,3 @@ $AUTOMAKE
> > > grep 'AM_V_GEN' Makefile.in
> > > $AUTOMAKE --force -Wno-all -Wportability
> > > grep 'AM_V_GEN' Makefile.in
> > > -
> > > -:
> >
> > Please don't remove trailing ':' or 'Exit 0'. They exist for a
> > reason: when somebody changes the test by adding a failing
> > command after the last command, the test will spuriously fail
> > because $? is nonzero at the end. Keeping a trailing ':'
> > prevents that.
>
> Good point, I dindn't think of that. What about an addition to
> tests/README explicitly telling that apparently reduntant trailing
> commands are there for a good reason indeed? My try is attached.
>
> > (And no, please also don't newly introduce these things just for
> > the heck of it either (i.e., when you wouldn't otherwise be
> > editing the test), that's not the point.)
>
> Yes, that would not be worth doing, since a missing trailing `:'
> does not change the semantic of the test (while e.g. a missing
> `set -e' does). Moreover, the absence of `:' could cause false
> positives only, which are much much easier to spot than the false
> negatives that could be introduced by a missing `set -e'.
>
> Regards,
> Stefano
>
From e3d76049ce6005e89448194d9dd158d7c42f6a6e Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 26 Apr 2010 10:46:43 +0200
Subject: [PATCH] Extend tests/README (trailing `:' in test scripts)
* tests/README (section "Writing test cases" subsection "Do"):
Explain why apparently redundant trailing `:' and `Exit 0' in
test scripts can indeed be useful.
---
ChangeLog | 8 ++++++++
tests/README | 7 +++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6b927ba..a9cf08c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
2010-06-11 Stefano Lattarini <address@hidden>
+ Ralf Wildenhues <address@hidden>
+
+ Extend tests/README w.r.t. trailing `:' in test scripts.
+ * tests/README (section "Writing test cases" subsection "Do"):
+ Explain why apparently redundant trailing `:' and `Exit 0' in
+ test scripts can indeed be useful.
+
+2010-06-11 Stefano Lattarini <address@hidden>
Improve determination of PATH separator in bootstrap script.
* bootstrap: Detemine what the PATH separator is the same way
diff --git a/tests/README b/tests/README
index c34bfd8..7037591 100644
--- a/tests/README
+++ b/tests/README
@@ -129,6 +129,13 @@ Do
Use `set -e' to catch failures you might not have thought of.
+ End the test script with a `:' or `Exit 0'. Otherwise, when somebody
+ changes the test by adding a failing command after the last command,
+ the test will spuriously fail because $? is nonzero at the end.
+ Note that this is relevant also for tests using `set -e', if they
+ contain commands like "grep ... Makefile.in && Exit 1" (and there
+ are indeed a lot of such tests).
+
Use $ACLOCAL, $AUTOMAKE, $AUTOCONF, $AUTOUPDATE, $AUTOHEADER,
$PERL, $MAKE, $EGREP, and $FGREP, instead of the corresponding
commands.
--
1.6.5
- [PATCH] Extend tests/README (trailing `:' in test scripts),
Stefano Lattarini <=