Subject: Re: bug#11896: aclocal7.sh test fails sometimes with automake-1.12.2

From: Stefano Lattarini <[email-masked]>
Date: Tue, 10 Jul 2012 15:26:13 +0200

tags 11896 + patch
severity 11896 minor
close 11896
thanks

On 07/10/2012 01:18 PM, Adam Sampson wrote:
> Hi,
Hi Adam, thanks for the report and the patch.

> I've just built automake-1.12.2 and had the aclocal7.sh test fail. After
> a bit of investigation, it's because the test:
> 
> - creates a .m4 file;
> - calls aclocal;
> - calls automake;
> - sleeps for a bit;
> - calls aclocal again;
> - calls automake again;
> - checks that those two calls didn't actually write any files.
>   [then goes on to test some other stuff that works fine]
> 
> The problem is that aclocal decides whether to rewrite its output file
> by checking that all of the input files it's read are older than the
> existing output file. If aclocal takes less than a second to run in the
> sequence above, it's possible for its output file to have the same
> timestamp as the .m4 file -- and then the second call to aclocal will
> decide the output file needs rewriting, and the test fails.
>
Oops, I introduced this error in a previous commit (v1.12.1-46-g13dd512).

> The attached patch adds a $sleep after creating the .m4 file, so it'll
> definitely be older than the first aclocal's output.
>
I've applied the fix in your name (see attached patch), and pushed.

I'm thus closing this bug report.

Thanks,
  Stefano
>From cf80959825ac3b18271d0c15ce7345e64410c2f0 Mon Sep 17 00:00:00 2001
Message-Id: <cf8095982[email-masked]>
From: Adam Sampson <[email-masked]>
Date: Tue, 10 Jul 2012 15:08:15 +0200
Subject: [PATCH] tests: fix spurious failure in aclocal7.sh on fast machines

Fixes automake bug#11896.  Issue introduced in commit v1.12.1-46-g13dd512.

* t/aclocal7.sh: Since aclocal rewrites aclocal.m4 unless the input files
are all older than the existing aclocal.m4, so we must sleep to ensure
somedefs.m4 has an older timestamp than the aclocal.m4 the next aclocal
call will generate.

Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini <[email-masked]>
---
 t/aclocal7.sh |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/t/aclocal7.sh b/t/aclocal7.sh
index 4c03a0c..c050b07 100755
--- a/t/aclocal7.sh
+++ b/t/aclocal7.sh
@@ -45,6 +45,11 @@ AUTOMAKE_after_aclocal ()
   $AUTOMAKE --no-force
 }
 
+# aclocal will rewrite aclocal.m4 unless the input files are all older than the
+# existing aclocal.m4 -- sleep to ensure somedefs.m4 has an older timestamp
+# than the aclocal.m4 that the next aclocal call will generate.
+$sleep
+
 $ACLOCAL -I m4
 AUTOMAKE_after_aclocal
 
-- 
1.7.9.5