* lib/autotest/general.m4 (AT_INIT) <Fifo job dispatcher>: Remove commented closing of job output fd. In serial test group driver, ensure $at_jobs is set to 1, so other parts of Autotest can reliably use this variable as indicator for parallel testing. (AT_CLEANUP): Inside the subshell for the test group, close AT_JOB_FIFO_IN_FD and AT_JOB_FIFO_OUT_FD if they are open.
Signed-off-by: Ralf Wildenhues <ralf.wildenh...@gmx.de> --- * Eric Blake wrote on Wed, Jul 21, 2010 at 05:49:59AM CEST: > Technically, the AT_CHECK commands only need worry about one fd; > AT_JOB_FIFO_OUT_FD (in fact, my patch already clobbers AT_JOB_FIFO_IN_FD > before the test is run), For all but the first child. > because that is the only fd that must still > exist after the AT_CHECK has completed. > Notice that we have this line: > > . "$at_test_source" [#] AT_JOB_FIFO_OUT_FD>&- This, IIRC, is commented out because it is not portable to do such redirections on '.' commands. > At one point, we already thought about closing the fd only during the > duration of the AT_CHECK, leaving it free for the AT_CHECK to use at > will (and more importantly, so that AT_CHECK can't do 'echo >&7' to > corrupt the state of the parallel test driver); it would just take > un-commenting that line. > > Additionally, it is not just AT_CHECK, but the entire > AT_SETUP/AT_CLEANUP set that is run in a subshell. Ah, good, so we should be able to close all open fds here (two for the first child, one for the rest). Something like this, which should also improve the case where --jobs=N was passed but e.g., mkfifo didn't work out. Cheers, Ralf ChangeLog | 10 ++++++++++ lib/autotest/general.m4 | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9146c3..09d7590 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-07-21 Ralf Wildenhues <ralf.wildenh...@gmx.de> + + Avoid passing autotest job fds to test groups. + * lib/autotest/general.m4 (AT_INIT) <Fifo job dispatcher>: Remove + commented closing of job output fd. In serial test group driver, + ensure $at_jobs is set to 1, so other parts of Autotest can + reliably use this variable as indicator for parallel testing. + (AT_CLEANUP): Inside the subshell for the test group, close + AT_JOB_FIFO_IN_FD and AT_JOB_FIFO_OUT_FD if they are open. + 2010-07-20 Paul Eggert <egg...@cs.ucla.edu> and Eric Blake <ebl...@redhat.com> diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index f328ef4..fd89714 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -1405,7 +1405,7 @@ dnl kill -13 $$ at_fn_group_prepare if cd "$at_group_dir" && at_fn_test $at_group && - . "$at_test_source" [#] AT_JOB_FIFO_OUT_FD>&- + . "$at_test_source" then :; else AS_WARN([unable to parse test group: $at_group]) at_failed=: @@ -1440,6 +1440,7 @@ dnl kill -13 $$ wait else # Run serially, avoid forks and other potential surprises. + at_jobs=1 for at_group in $at_groups; do at_fn_group_prepare if cd "$at_group_dir" && @@ -1913,6 +1914,12 @@ AT_xfail echo "# -*- compilation -*-" >> "$at_group_log" ( AS_ECHO(["AT_ordinal. m4_defn([AT_line]): testing $at_desc ..."]) + if test $at_jobs -ne 1; then + if $at_first; then + exec AT_JOB_FIFO_IN_FD>&- + fi + exec AT_JOB_FIFO_OUT_FD>&- + fi $at_traceon m4_undivert([TEST_SCRIPT])dnl Insert the code here set +x -- 1.7.2.rc3.47.g996ce