[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: syntax error in . file (was: test failures on AIX 5.3)
From: |
Eric Blake |
Subject: |
Re: syntax error in . file (was: test failures on AIX 5.3) |
Date: |
Thu, 2 Jul 2009 17:43:49 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
> Aargh. That's what I get for posting without testing; yes, I saw that
> during execution as well. It may be possible to depend more on the
> filesystem to pass information back (have at_fn_test append some
> boilerplate at the end of $at_test_source, and if the boilerplate isn't
> reached, the testsuite knows the test group must have aborted early,
> working around even the zsh bug of not detecting failure). But that's
> more invasive, and I don't want to do it until after 2.64. So for now,
> let's just go with this simpler patch, tested with bash (still passes),
> zsh (skips because of the failure to detect error) and ash (skips because
> syntax errors are fatal; well, it will once I check in another patch that
> hides <> redirection from choking ash).
That patch missed a case - zsh fails 'parallel syntax error' for the same
reason, although most other shells merely skipped that test. Also, here's the
promised patch to make the testsuite run once again under ash.
From: Eric Blake <address@hidden>
Date: Thu, 2 Jul 2009 11:32:39 -0600
Subject: [PATCH] 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.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 9 +++++++++
doc/autoconf.texi | 12 ++++++++++++
lib/autotest/general.m4 | 5 +++--
tests/autotest.at | 30 ++++++++++++++++++++----------
4 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4d5d532..c7c57fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2009-07-02 Eric Blake <address@hidden>
+ 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.
+
Skip test on shells that can't catch syntax failure.
* tests/autotest.at (Syntax error): Skip test if shell aborts on
syntax error (AIX ksh88) or doesn't detect it (zsh).
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 04e3b10..3528f53 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -14187,6 +14187,18 @@ File Descriptors
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:
+
address@hidden
+$ @kbd{mkfifo fifo}
+$ @kbd{exec 5<>fifo}
+$ @kbd{echo hi >&5}
+bash: echo: write error: Communication error on send
address@hidden example
+
When catering to old systems, don't redirect the same file descriptor
several times, as you are doomed to failure under Ultrix.
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index ddc2270..f66b85a 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -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.
diff --git a/tests/autotest.at b/tests/autotest.at
index 6f0bd1d..e83b329 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -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])
--
1.6.3.2