automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#8365: 3 of 657 tests failed


From: Stefano Lattarini
Subject: Re: bug#8365: 3 of 657 tests failed
Date: Sat, 2 Apr 2011 10:33:19 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Friday 01 April 2011, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Fri, Apr 01, 2011 at 06:50:12PM CEST:
> > On Friday 01 April 2011, Ralf Wildenhues wrote:
> > > >  tests/remake-bug8365.test |   99 
> > > > +++++++++++++++++++++++++++++++++++++++++++++
> > > 
> > > and the name of the new test is inconsistent.  I suggest either
> > > pr8365.test (yeah, can see you cringe already) or remake-timing.test
> > > or so.
> > >
> > [Disclaimer: BIKESHEDDING follows]
> > I have to object to this.  First, IMHO the "correct" way to resolve
> > this inconsistency would be to give more expressive names to the
> > existing `pr*.test' tests (so that `pr9.test' would become, e.g.,
> > `config-aux-dir-pr9.test'), not to "dumb down" the names of new tests.
> > Second, I really do believe that a name like `remake-bug8365.test' is
> > better than your proposed alternatives, because it's a good compromise
> > between length and expressivenes:
> 
> If you want both number and expressive name, let's put the number first,
> so that the first 8 characters of the name before the dot can be unique,
> e.g., pr8365-remake-timing.test.  At least that is portable then.
>
Agreed, done.

> > > Will the new test work on a file system with sub-second granularity
> > > where 'touch' has the issues described at 'info Autoconf --index touch'?
> > >
> > Uh-oh, this could be a problem.  In order to trigger the bug, various
> > files need to have the *same* timestamp.  So what about using the `-t'
> > option of touch instead?  See the attached squash-in.
> 
> Well, the 'date' options are not so portable, see the Autoconf manual.
> I wouldn't fix anything until I see a failure in the wild.
>
Still, I might have managed to tweak the test to take into account,
and work with, timestamp truncation.  See the attached squash-in (the
whole resulting test script is also attached, for reference).  WDYT?

Regards,
  Stefano
diff --git a/tests/pr8365-remake-timing.test b/tests/pr8365-remake-timing.test
index a247c21..079b0c0 100755
--- a/tests/pr8365-remake-timing.test
+++ b/tests/pr8365-remake-timing.test
@@ -26,6 +26,9 @@
 
 set -e
 
+# We'll use calls to stat to get debugging information.
+if stat /dev/null; then stat=stat; else stat=:; fi
+
 cat >> configure.in << 'END'
 FOOBAR=zardoz
 AC_OUTPUT
@@ -46,18 +49,17 @@ $EGREP 'FOOBAR|zardoz' Makefile && Exit 99 # Sanity check.
 echo 'AC_SUBST([FOOBAR])' >> configure.in
 
 # Modified configure dependencies must have the same timestamp of
-# config.status and Makefile in order to trigger the bug.  Also,
-# `touch -r FILE' can truncate timestamps on some systems (see
-# Autoconf manual), thus we need to use explicit timestamps.
-timestamp=`date '+%Y%m%d%H%M.%S'` && test -n "$timestamp" || {
-  echo "$me: cannot get current time in required format" >&2
-  Exit 77
-}
-touch -t "$timestamp" Makefile config.status configure.in || {
-  echo "$me: couldn't set timestamp of files to current time" >&2
-  Exit 77
-}
-stat config.status Makefile configure.in || : # For debugging.
+# config.status and Makefile in order to trigger the bug.
+# We also re-touch config.status, because "touch -r" can truncate
+# timestamps on file systems with sub-second resolutions (see the
+# autoconf manual).  Finally, we also sleep before touching, to ensure
+# that the (possibly truncated) timestamps of config.status etc. are
+# strictly newer than the non-truncated configure timestamp.
+$stat config.status Makefile configure.in
+$sleep
+touch config.status
+touch -r config.status config.status Makefile configure.in
+$stat config.status Makefile configure.in
 
 # Also, the race condition is triggered only when aclocal, automake
 # and aclocal run fast enough to keep the timestamp of the generated
@@ -74,8 +76,8 @@ set -ex
 # the races from configure.in.
 AUTOCONF='$save_AUTOCONF'; export AUTOCONF
 $ACLOCAL "\$@"
-touch -t '$timestamp' aclocal.m4
-stat aclocal.m4 || :
+touch -r config.status aclocal.m4
+$stat aclocal.m4
 END
 
 cat > automake-wrap <<END
@@ -85,16 +87,16 @@ set -ex
 # the races from configure.in.
 AUTOCONF='$save_AUTOCONF'; export AUTOCONF
 $AUTOMAKE "\$@"
-touch -t '$timestamp' Makefile.in
-stat Makefile.in || :
+touch -r config.status Makefile.in
+$stat Makefile.in
 END
 
 cat > autoconf-wrap <<END
 #!/bin/sh
 set -ex
 $AUTOCONF "\$@"
-touch -t '$timestamp' configure
-stat configure || :
+touch -r config.status configure
+$stat configure
 END
 
 chmod a+x aclocal-wrap automake-wrap autoconf-wrap

Attachment: pr8365-remake-timing.test
Description: application/shellscript


reply via email to

[Prev in Thread] Current Thread [Next in Thread]