Make ‘forbidden tokens, basic’ test more robust.

While testing the previous patch I noticed that the ‘forbidden tokens,
basic’ test can fail if it runs too fast, because the autom4te cache
files aren’t considered newer than configure.ac.

* tests/tools.at (forbidden tokens, basic): Add delays to ensure
  autom4te.cache files are newer than configure.ac.
This commit is contained in:
Zack Weinberg 2020-11-05 10:24:08 -05:00
parent 0f7e5a5477
commit 8e54013958
No known key found for this signature in database
GPG Key ID: 384F8E68AC65B0D5

View File

@ -450,7 +450,7 @@ _AS_BAR
[dnl]
]])
dnl This test needs autom4te's cache, in spite of any ~/.autom4te.cfg.
# This test needs autom4te's cache, in spite of any ~/.autom4te.cfg.
AT_DATA([.autom4te.cfg], [[
begin-language: "Autoconf"
args: --cache=autom4te.cache
@ -460,6 +460,10 @@ args: --cache=autom4te.cache
end-language: "Autoconf-without-aclocal-m4"
]])
# Delay to make sure the cache files generated by the next command are
# considered newer than configure.ac.
sleep 2
AT_CHECK_AUTOCONF([], 1, [],
[[trailer.m4: warning: AC_INIT was never used
trailer.m4: warning: AC_OUTPUT was never used
@ -471,6 +475,11 @@ configure.ac:4: error: possibly undefined macro: AS@&t@_FOO
configure.ac:5: error: possibly undefined macro: _AS@&t@_BAR
configure.ac:6: error: possibly undefined macro: d@&t@nl
]])
# Delay to make sure the cache files generated by the previous command
# are considered to have been created in the past.
sleep 2
# A second run (without --force) should succeed and yield only the
# warnings about AC_INIT and AC_OUTPUT.
AT_CHECK_M4([autoconf], 0, [],