From: Eric Blake Date: Mon, 6 Apr 2009 16:40:49 +0000 (-0600) Subject: Hard fail any test with syntax errors. X-Git-Tag: v2.64~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57e6f69b99f75f72049fc92b0143837747dc1c83;p=thirdparty%2Fautoconf.git Hard fail any test with syntax errors. * lib/autotest/general.m4 (AT_INIT) : Guarantee test failure on syntax error, rather than inheriting status from previous test. * tests/autotest.at (Syntax error): New test. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index f0f9296d2..fba76adf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-04-06 Eric Blake + + Hard fail any test with syntax errors. + * lib/autotest/general.m4 (AT_INIT) : + Guarantee test failure on syntax error, rather than inheriting + status from previous test. + * tests/autotest.at (Syntax error): New test. + 2009-03-31 Eric Blake Beta Release Version 2.63b. diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index 86a5c6aa2..77058544a 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -1130,6 +1130,7 @@ at_fn_group_postprocess () report this failure to . _ATEOF AS_ECHO(["$at_setup_line"]) >"$at_check_line_file" + at_xfail=no at_status=99 fi $at_verbose AS_ECHO_N(["$at_group. $at_setup_line: "]) AS_ECHO_N(["$at_group. $at_setup_line: "]) >> "$at_group_log" @@ -1903,7 +1904,7 @@ _AT_DEFINE_SETUP([AT_CHECK_NOESCAPE], # _AT_DECIDE_TRACEABLE(COMMANDS) # ------------------------------ -# Worker for for _AT_CHECK that expands to shell code. If COMMANDS are safe to +# Worker for _AT_CHECK that expands to shell code. If COMMANDS are safe to # trace with `set -x', the shell code will evaluate to true. Otherwise, # the shell code will print a message stating an aspect of COMMANDS that makes # tracing them unsafe, and evaluate to false. @@ -2042,7 +2043,7 @@ m4_define([AT_DIFF_STDOUT()], # filter out the unadorned trace lines, we disable shell tracing entirely for # commands that could span multiple lines. # -# Limiting COMMANDS to a single command is not good either, since them +# Limiting COMMANDS to a single command is not good either, since then # the user herself would use {} or (), and then we face the same problem. # # But then, there is no point in running diff --git a/tests/autotest.at b/tests/autotest.at index 1ed19a63a..a49ea1b7f 100644 --- a/tests/autotest.at +++ b/tests/autotest.at @@ -236,9 +236,9 @@ AT_CLEANUP ]], [], [], [], [], [], [AT_CHECK([sed -n '/exec AS_MESSAGE_LOG_FD/q; />&AS_MESSAGE_LOG_FD/p' < micro-suite])]) -## ----------------------------------------------------- ## -## Newlines and command substitutions in test commands. ## -## ----------------------------------------------------- ## +## ----------------- ## +## Status handling. ## +## ----------------- ## AT_CHECK_AT_TEST([Truth], [AT_CHECK([:], 0, [], [])]) @@ -253,6 +253,18 @@ AT_CHECK_AT_TEST([Skip], [], [], [], [], [], [AT_CHECK([grep skipped micro-suite.log], [], [ignore])]) +AT_CHECK_AT_TEST([Syntax error], + [AT_CHECK([:]) + AT_CLEANUP + AT_SETUP([syntax]) + AT_CHECK([if]) + AT_CLEANUP + AT_SETUP([another test]) + AT_CHECK([:])], + [], [1], [], [stderr], [], + [AT_CHECK([grep "unable to parse test group: 2" stderr], [0], [ignore]) + AT_CHECK([$CONFIG_SHELL ./micro-suite 1 3], [0], [ignore])]) + AT_CHECK_AT_TEST([errexit], [AT_CHECK([false]) AT_CLEANUP @@ -265,6 +277,10 @@ AT_CHECK_AT_TEST([errexit], AT_CHECK([grep "1 .* inhibited subsequent" stderr], [], [ignore])], [--errexit]) +## ----------------------------------------------------- ## +## Newlines and command substitutions in test commands. ## +## ----------------------------------------------------- ## + AT_CHECK_AT_TEST([Literal multiline command], [AT_CHECK([echo Auto' 'conf], 0, [Auto