From: Karl Berry Date: Mon, 25 Dec 2023 23:38:15 +0000 (-0800) Subject: test: force long sleep with explicit cache variable setting. X-Git-Tag: v1.16.90~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0249be1e9b763ea2188a3050822b2c7b24b2a6ec;p=thirdparty%2Fautomake.git test: force long sleep with explicit cache variable setting. From https://bugs.gnu.org/67670. * t/ax/test-defs.in: when MTIME_RESOLUTION is set to 1 because automake/autom4te do not support subsecond-mtime, also set am_cv_sleep_fractional_seconds=false. Otherwise the random parallel test failures from given bug and others return. * m4/sanity.m4 (_AM_SLEEP_FRACTIONAL_SECONDS): reformat. (_AM_FILESYSTEM_TIMESTAMP_RESOLUTION): elide "the" in AC_CACHE_CHECK. * t/amassign.sh: end with :. * HACKING: more on debugging tests. * NEWS: update. --- diff --git a/HACKING b/HACKING index e642d2eb0..85dd89a5a 100644 --- a/HACKING +++ b/HACKING @@ -42,7 +42,8 @@ should be updated by hand whenever the GPL gets updated (which shouldn't happen that often anyway :-). -* All changes that are not trivial bug fixes must be mentioned in NEWS. +* All changes from the last release that are not trivial bug fixes should + be mentioned in NEWS. * Changes which are potentially controversial, require a non-trivial plan, or must be implemented gradually with a roadmap spanning several @@ -374,20 +375,18 @@ * You can run a single test, with, e.g., make check TESTS='t/aclocal-acdir.sh' - where t/aclocal-acdir.sh can be any t/*.sh test, including a new one you are writing. You may want to add --no-print-dir to silence GNU make about the many cd commands, and/or env VERBOSE=1 to get more information about what make is running. -* Sometimes you may want to see when each test starts running, and not - just when they complete. This can be done by setting TESTS_ENVIRONMENT, - as in: +* Sometimes you may want to see when each test starts running, not only + when they complete. This can be done by setting TESTS_ENVIRONMENT: make -j12 VERBOSE=1 TESTS_ENVIRONMENT='echo RUNNING: "$$f";' check * Run "make maintainer-check" before commit. Watch out for trailing spaces. - It may be useful to run it more verbose: - make AM_V_GEN= VERBOSE=1 maintainer-check + Probably useful to run it more verbosely: + make AM_V_GEN= AM_V_at= VERBOSE=1 maintainer-check * After "make -j12 check" succeeds. run "make -j12 distcheck" before pushing a commit, since that exercises yet more of the code. @@ -409,25 +408,58 @@ make check TESTS='t/good-name.sh' - During development of a new test, it can be useful to end it with - "exit 33" (or whatever random value) to force it to fail even when it - would otherwise succeed, so you can inspect the test directory to be - sure things worked as expected. + "exit 33" (or any random value) to force it to fail even when it would + otherwise succeed, so you can inspect the test.dir/test.log and other + test.dir/* files to be sure things worked as expected. - At some point before releasing, add the test to the appropriate variable in t/list-of-tests.mk, most likely the (alphabetical) handwritten_TESTS. +* Some hints for debugging test failures or trying to understand the + (complex) test infrastructure. + + - You may want a simple test just to exercise the setup; t/amassign.sh + is such a test. For a simple test that runs automake twice (sometimes + useful in finding concurrency failures), try t/nodef.sh. + + - The t/ax/ dir contains most of the test infrastructure files. + + - To trace the (complex) test initialization code, change the set -e + to set -ex (or whatever you wish) in t/ax/test-init.sh. + Automake itself enables -x for the *.log and test-suite.log files, + in am_test_setup in t/ax/test-lib.sh. You may want to change to -vx. + + - If you want to run the individual commands of a test one by one in a + shell, you have to reproduce the test environment. Start a subshell and: + PATH=$am/bin:$am/t/ax:$PATH # where $am is your automake source checkout + set +u # if needed; automake cannot handle this "nounset" option + . test-init.sh # beginning of test + Then each command you type will be executed in the test environment, + including -x being enabled. Each test prints the PATH value at the beginning. + + - If you need to debug a test which fails under installcheck, you need + to invoke make with am_running_installcheck=yes, as is done by the + installcheck-testsuite target in t/local.mk. + + - If you want to see the (complex shell) commands that make is + running, despite all of Automake's attempt at silence, run (GNU) + make --debug=p ... other make args ... + ============================================================================ = Bug tracker * Automake uses the debbugs instance at https://bugs.gnu.org. Email from the tracker is sent to bug-automake@gnu.org, and vice versa. - (https://gnu.org/s/automake for all the mailing lists; you should subscribe.) + Ditto automake-patches@gnu.org. (See + https://gnu.org/s/automake for all the mailing lists; if you're + working on Automake, please subscribe.) -* To see all open bugs (and recently closed ones): +* To see all open bugs resp. patches (and recently closed ones): https://debbugs.gnu.org/cgi/pkgreport.cgi?pkg=automake + https://debbugs.gnu.org/cgi/pkgreport.cgi?pkg=automake-patches -* For a full search form, initialized to show bugs tagged confirmed: +* For a full search form, initialized to show only bugs tagged confirmed: https://debbugs.gnu.org/cgi/pkgreport.cgi?package=automake;include=tags%3Aconfirmed * We use the "confirmed" tag to mean bugs that have been reviewed, are @@ -437,7 +469,7 @@ * To download the so-called maintainer mbox for a bug, say 12345: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=12345;mbox=yes;mboxmaint=yes Only the maintainer mbox consistently has the bug# prefix on Subject: - lines, so it is generally the most usable. + lines, so it is the most usable, as far as we know. * To close a bug, you can mail (or bcc) to 12345-done@debbugs.gnu.org. It's best to do this with a note saying that the bug is being closed diff --git a/NEWS b/NEWS index 5b56a7283..276dcc9da 100644 --- a/NEWS +++ b/NEWS @@ -45,13 +45,13 @@ New in 1.17: - Generated file timestamp checks handle filesystems with sub-second timestamp granularity dynamically, greatly speeding up make check, - etc. However, this requires an autom4te from Autoconf 2.72 (as yet - unreleased) or later (or random test failures and other timing - problems may ensue), as well as a Perl, sleep utility, and - filesystem that supports sub-second resolution; otherwise, we fall - back to one-second granularity as before. When everything is - supported, a new line `Features: subsecond-mtime' is printed by - automake --version (and autom4mte --version). (bug#64756, bug#67670) + etc. However, this requires an autom4te from Autoconf 2.72 or later + (or random test failures and other timing problems may ensue), as + well as a Perl, sleep utility, and filesystem that supports + sub-second resolution; otherwise, we fall back to one-second + granularity as before. When everything is supported, a line + `Features: subsecond-mtime' is now printed by automake --version + and autom4mte --version. (bug#64756, bug#67670) - The default value of $ARFLAGS is now "cr" instead of "cru", to better support deterministic builds. (bug#20082) @@ -85,6 +85,8 @@ New in 1.17: - Pass any options given to AM_PROG_LEX on to AC_PROG_LEX. (bug#65600, bug#65730) + - Typos in code and other doc fixes. (bug#68003, bug#68004, et al.) + * Obsolescence: - py-compile no longer supports Python 0.x or 1.x versions. Python 2.0, diff --git a/m4/sanity.m4 b/m4/sanity.m4 index 93c4854b9..3e3c5828c 100644 --- a/m4/sanity.m4 +++ b/m4/sanity.m4 @@ -9,8 +9,10 @@ # _AM_SLEEP_FRACTIONAL_SECONDS # ---------------------------- AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl -AC_CACHE_CHECK([whether sleep supports fractional seconds], am_cv_sleep_fractional_seconds, [dnl -AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=true], [am_cv_sleep_fractional_seconds=false]) +AC_CACHE_CHECK([whether sleep supports fractional seconds], + am_cv_sleep_fractional_seconds, [dnl +AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=true], + [am_cv_sleep_fractional_seconds=false]) ])]) # _AM_FILESYSTEM_TIMESTAMP_RESOLUTION @@ -25,7 +27,7 @@ AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=true], [am_cv_s # granularity, so we don't check for anything finer than that. AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS]) -AC_CACHE_CHECK([the filesystem timestamp resolution], am_cv_filesystem_timestamp_resolution, [dnl +AC_CACHE_CHECK([filesystem timestamp resolution], am_cv_filesystem_timestamp_resolution, [dnl # Default to the worst case. am_cv_filesystem_timestamp_resolution=2 diff --git a/t/amassign.sh b/t/amassign.sh index 1ad40b9d8..0fcacb307 100644 --- a/t/amassign.sh +++ b/t/amassign.sh @@ -26,3 +26,5 @@ AC_SUBST([AM_ZARDOZ]) END $ACLOCAL + +: diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in index 696403ee0..bca675fcd 100644 --- a/t/ax/test-defs.in +++ b/t/ax/test-defs.in @@ -193,9 +193,20 @@ case $MTIME_RESOLUTION in : else MTIME_RESOLUTION=1 + # we must not sleep for fractional seconds when autom4te does not + # support subsecond-mtimes, even when sleep supports it. See bug#67670. + am_cv_sleep_fractional_seconds=false + export am_cv_sleep_fractional_seconds fi ;; esac + +# This sleep variable is used explicitly in some tests to avoid +# too-quick creation. I (Karl) believe that was an incomplete workaround +# for this whole subsecond-mtime problem. With this set to "sleep 1", +# there were still random parallelization failures, without also setting +# am_cv_sleep_fractional_seconds=false as above. +# sleep="sleep $MTIME_RESOLUTION" # An old timestamp that can be given to a file, in "touch -t" format. @@ -205,8 +216,8 @@ sleep="sleep $MTIME_RESOLUTION" old_timestamp=198309271735.59 # Make our wrapper script (or installed scripts, if running under -# "installcheck") accessible by default. And avoid to uselessly -# extend $PATH multiple times if this file is sourced multiple times. +# "installcheck") accessible by default. And avoid uselessly +# extending $PATH multiple times if this file is sourced multiple times. case $PATH in $am_bindir$PATH_SEPARATOR*) ;; *) PATH=$am_bindir$PATH_SEPARATOR$PATH;;