]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Avoid syntax error in ash.
authorEric Blake <ebb9@byu.net>
Thu, 2 Jul 2009 17:32:39 +0000 (11:32 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 3 Jul 2009 12:42:30 +0000 (06:42 -0600)
* lib/autotest/general.m4 (AT_INIT) <driver loop>: Avoid syntax
errors on shells that don't recognize <>.
* tests/autotest.at (AT_SKIP_PARALLEL_TESTS): Also skip parallel
tests for this reason.   Skip based on the shell to be tested,
not the shell driving the testsuite.
(parallel syntax error): Rearrange similar to previous patch.
(parallel test execution): Defer skip until after serial tests.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/autoconf.texi
lib/autotest/general.m4
tests/autotest.at

index 4d5d5324f1234dd334f74949096f4313059e1460..68c44906edaff1c19a01de52d19e1b5274953682 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-07-03  Eric Blake  <ebb9@byu.net>
+
+       Avoid syntax error in ash.
+       * lib/autotest/general.m4 (AT_INIT) <driver loop>: Avoid syntax
+       errors on shells that don't recognize <>.
+       * tests/autotest.at (AT_SKIP_PARALLEL_TESTS): Also skip parallel
+       tests for this reason.   Skip based on the shell to be tested,
+       not the shell driving the testsuite.
+       (parallel syntax error): Rearrange similar to previous patch.
+       (parallel test execution): Defer skip until after serial tests.
+
 2009-07-02  Eric Blake  <ebb9@byu.net>
 
        Skip test on shells that can't catch syntax failure.
index 04e3b10cf85c15c3c6c525465be25e05602557e0..3528f53251052900c4f6e38ad12ff032ac381b0d 100644 (file)
@@ -14187,6 +14187,18 @@ escape, while @samp{: `cd /zorglub 2>/dev/null`} works properly.
 It is worth noting that Zsh (but not Ash nor Bash) makes it possible
 in assignments though: @samp{foo=`cd /zorglub` 2>/dev/null}.
 
+Some shells, like @command{ash}, don't recognize bi-directional
+redirection (@samp{<>}).  And even on shells that recognize it, it is
+not portable to use on fifos: Posix does not require read-write support
+for named pipes, and Cygwin does not support it:
+
+@example
+$ @kbd{mkfifo fifo}
+$ @kbd{exec 5<>fifo}
+$ @kbd{echo hi >&5}
+bash: echo: write error: Communication error on send
+@end example
+
 When catering to old systems, don't redirect the same file descriptor
 several times, as you are doomed to failure under Ultrix.
 
index ddc2270a02d7e887d501cab1e717e8c9c7bcd078..50c2ff70ae5c69af1a0e7376ad36d92b2d6f183e 100644 (file)
@@ -1296,8 +1296,9 @@ at_first=:
 if test $at_jobs -ne 1 &&
      rm -f "$at_job_fifo" &&
      test -n "$at_job_group" &&
-     ( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null &&
-     exec AT_JOB_FIFO_FD<> "$at_job_fifo"
+     ( mkfifo "$at_job_fifo" && eval 'exec AT_JOB_FIFO_FD<> "$at_job_fifo"' \
+       && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null &&
+     eval 'exec AT_JOB_FIFO_FD<> "$at_job_fifo"'
 then
   # FIFO job dispatcher.
 
@@ -1352,7 +1353,7 @@ dnl optimize away the _AT_CHECK subshell, so normalize here.
 dnl Ignore PIPE signals that stem from writing back the token.
            trap "" PIPE
            echo stop > "$at_stop_file"
-           echo token >&6
+           echo token >&AT_JOB_FIFO_FD
 dnl Do not reraise the default PIPE handler.
 dnl It wreaks havoc with ksh, see above.
 dnl        trap - 13
index 6f0bd1d5ad80741586bedd6a229c9689a2e3dfb5..e83b329799d384fdc018f44ebe8d1112e8dce9de 100644 (file)
@@ -990,8 +990,11 @@ m4_define([AT_SKIP_PARALLEL_TESTS],
 [# Per BUGS, we have not yet figured out how to run parallel tests cleanly
 # under dash and some ksh variants.  For now, only run this test under
 # limited conditions; help is appreciated in widening this test base.
-AT_CHECK([test -n "${BASH_VERSION+set}${ZSH_VERSION+set}]]dnl
-[[${TEST_PARALLEL_AUTOTEST+set}" || exit 77])
+AT_CHECK([${CONFIG_SHELL-$SHELL} -c 'test -n "${BASH_VERSION+set}]]dnl
+[[${ZSH_VERSION+set}${TEST_PARALLEL_AUTOTEST+set}"' || exit 77])
+# The parallel scheduler requires mkfifo and bidirectional redirection to work.
+AT_CHECK([mkfifo fifo || exit 77])
+AT_CHECK([${CONFIG_SHELL-$SHELL} -c 'eval "exec 5<>fifo"' || exit 77])
 ])
 
 
@@ -1001,8 +1004,6 @@ AT_CHECK([test -n "${BASH_VERSION+set}${ZSH_VERSION+set}]]dnl
 
 AT_SETUP([parallel test execution])
 
-AT_SKIP_PARALLEL_TESTS
-
 # This test tries to ensure that -j runs tests in parallel.
 # Such a test is inherently racy, because there are no real-time
 # guarantees about scheduling delays.  So we try to minimize
@@ -1053,13 +1054,17 @@ m4_for([count], [1], ]]AT_PARALLEL_NTESTS[[, [],
 ])
 ]])
 
+# Even if parallel jobs are not supported, the command line must work.
 AT_CHECK([$CONFIG_SHELL ./micro-suite --help | grep " --jobs"], [0], [ignore])
 AT_CHECK([$CONFIG_SHELL ./micro-suite -j2foo], [1], [], [stderr])
 AT_CHECK([grep 'non-numeric argument' stderr], [], [ignore])
 AT_CHECK([$CONFIG_SHELL ./micro-suite --jobs=foo], [1], [], [stderr])
 AT_CHECK([grep 'non-numeric argument' stderr], [], [ignore])
-AT_CHECK([$CONFIG_SHELL ./micro-suite -j[]AT_PARALLEL_NJOBS], [], [stdout])
+
+AT_SKIP_PARALLEL_TESTS
+
 # Ensure that all tests run, and lines are not split.
+AT_CHECK([$CONFIG_SHELL ./micro-suite -j[]AT_PARALLEL_NJOBS], [], [stdout])
 AT_CHECK([grep -c '^.\{53\}ok' stdout], [], [AT_PARALLEL_NTESTS
 ])
 # Running one test with -j should produce correctly formatted output:
@@ -1074,8 +1079,6 @@ AT_CHECK([grep -c '^.\{53\}ok' stdout], [], [1
 AT_CHECK([$CONFIG_SHELL ./micro-suite -j -k nomatch], [], [ignore])
 AT_CHECK([$CONFIG_SHELL ./micro-suite -j3 -k nomatch], [], [ignore])
 
-# The parallel scheduler requires mkfifo to work.
-AT_CHECK([mkfifo fifo || exit 77])
 mkdir serial
 
 # Unfortunately, the return value of wait is unreliable,
@@ -1113,9 +1116,16 @@ AT_CHECK_AT_TEST([parallel syntax error],
    AT_CLEANUP
    AT_SETUP([another test])
    AT_CHECK([:])],
-  [], [1], [], [stderr], [AT_SKIP_PARALLEL_TESTS],
-  [AT_CHECK([grep "unable to parse test group: 2" stderr], [0], [ignore])
-   AT_CHECK([$CONFIG_SHELL ./micro-suite -j 3], [0], [ignore])], [-j])
+  [], [0], [], [], [AT_SKIP_PARALLEL_TESTS],
+  [dnl Until we can find a way to avoid catastrophic failure (ash) or
+   dnl lack of failure (zsh), skip the rest of this test on such shells.
+   echo 'if' > syntax
+   AT_CHECK([${CONFIG_SHELL-$SHELL} -c 'case `. ./syntax; echo $?` in
+                 0|"") exit 77;;
+               esac'], [0], [ignore], [ignore])
+   AT_CHECK([$CONFIG_SHELL ./micro-suite -j], [1], [ignore], [stderr])
+   AT_CHECK([grep "unable to parse test group: 2" stderr], [0], [ignore])],
+  [-j2 1 3])
 
 AT_CHECK_AT_TEST([parallel errexit],
   [AT_CHECK([false])