mirror of
git://git.sv.gnu.org/autoconf
synced 2024-12-09 02:10:22 +08:00
Autotest: do not use shell functions for individual tests.
* lib/autotest/general.m4 (AT_INIT) <at_func_test>: Merely extract the source test source, do not invoke it. (AT_SETUP, AT_CLEANUP): Source test code outside shell function. * tests/autotest.at (Fallacy): Actually let the inner suite fail, expect exit status of 1. * tests/autotest.at (Skip): New test, for bogus zsh exit status.
This commit is contained in:
parent
e492685ef7
commit
b3aa97c727
@ -1,5 +1,13 @@
|
||||
2007-10-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||
|
||||
Autotest: do not use shell functions for individual tests.
|
||||
* lib/autotest/general.m4 (AT_INIT) <at_func_test>: Merely
|
||||
extract the source test source, do not invoke it.
|
||||
(AT_SETUP, AT_CLEANUP): Source test code outside shell function.
|
||||
* tests/autotest.at (Fallacy): Actually let the inner suite fail,
|
||||
expect exit status of 1.
|
||||
* tests/autotest.at (Skip): New test, for bogus zsh exit status.
|
||||
|
||||
* lib/autotest/general.m4 (at_func_test): Fix test extraction
|
||||
script.
|
||||
|
||||
|
@ -291,20 +291,11 @@ at_func_diff_devnull ()
|
||||
|
||||
# at_func_test NUMBER
|
||||
# -------------------
|
||||
# Parse out at_func_test_NUMBER from the tail of this file, source it,
|
||||
# then invoke it.
|
||||
# Parse out test NUMBER from the tail of this file.
|
||||
at_func_test ()
|
||||
{
|
||||
if sed -n '/^@%:@AT_START_'$[1]'$/,/^@%:@AT_STOP_'$[1]'$/p' "$at_myself" \
|
||||
> "$at_test_source" && . "$at_test_source" ; then
|
||||
at_func_test_$[1] || {
|
||||
AS_ECHO(["$as_me: unable to execute test group: $[1]"]) >&2
|
||||
at_failed=:
|
||||
}
|
||||
else
|
||||
AS_ECHO(["$as_me: unable to parse test group: $[1]"]) >&2
|
||||
at_failed=:
|
||||
fi
|
||||
sed -n '/^@%:@AT_START_'$[1]'$/,/^@%:@AT_STOP_'$[1]'$/p' "$at_myself" \
|
||||
> "$at_test_source"
|
||||
}
|
||||
|
||||
# Load the config file.
|
||||
@ -1295,12 +1286,10 @@ m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal]))
|
||||
m4_divert_push([TEST_FUNCTIONS])dnl
|
||||
[#AT_START_]AT_ordinal
|
||||
@%:@ AT_ordinal. m4_defn([AT_line]): m4_defn([AT_description])
|
||||
at_func_test_[]AT_ordinal ()
|
||||
{
|
||||
at_setup_line='m4_defn([AT_line])'
|
||||
at_desc="AS_ESCAPE(m4_dquote(m4_defn([AT_description])))"
|
||||
$at_quiet AS_ECHO_N([m4_format(["%3d: $at_desc%*s"], AT_ordinal,
|
||||
m4_max(0, m4_eval(47 - m4_qlen(m4_defn([AT_description])))), [])])
|
||||
at_setup_line='m4_defn([AT_line])'
|
||||
at_desc="AS_ESCAPE(m4_dquote(m4_defn([AT_description])))"
|
||||
$at_quiet AS_ECHO_N([m4_format(["%3d: $at_desc%*s"], AT_ordinal,
|
||||
m4_max(0, m4_eval(47 - m4_qlen(m4_defn([AT_description])))), [])])
|
||||
m4_divert_push([TEST_SCRIPT])dnl
|
||||
])
|
||||
|
||||
@ -1345,21 +1334,24 @@ m4_define([AT_CLEANUP],
|
||||
m4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords], [m4_defn([AT_keywords])]);
|
||||
)dnl
|
||||
m4_divert_pop([TEST_SCRIPT])dnl Back to TEST_FUNCTIONS
|
||||
AT_xfail
|
||||
echo "# -*- compilation -*-" >> "$at_group_log"
|
||||
(
|
||||
AS_ECHO(["AT_ordinal. m4_defn([AT_line]): testing $1..."])
|
||||
$at_traceon
|
||||
AT_xfail
|
||||
echo "# -*- compilation -*-" >> "$at_group_log"
|
||||
(
|
||||
AS_ECHO(["AT_ordinal. m4_defn([AT_line]): testing $1..."])
|
||||
$at_traceon
|
||||
m4_undivert([TEST_SCRIPT])dnl Insert the code here
|
||||
$at_traceoff
|
||||
$at_times_p && times >"$at_times_file"
|
||||
) AS_MESSAGE_LOG_FD>&1 2>&1 | eval $at_tee_pipe
|
||||
at_status=`cat "$at_status_file"`
|
||||
}
|
||||
$at_traceoff
|
||||
$at_times_p && times >"$at_times_file"
|
||||
) AS_MESSAGE_LOG_FD>&1 2>&1 | eval $at_tee_pipe
|
||||
at_status=`cat "$at_status_file"`
|
||||
[#AT_STOP_]AT_ordinal
|
||||
m4_divert_pop([TEST_FUNCTIONS])dnl Back to KILL.
|
||||
m4_divert_text([TESTS],
|
||||
[ AT_ordinal ) at_func_test AT_ordinal ;;])
|
||||
[ AT_ordinal )
|
||||
if at_func_test AT_ordinal && . "$at_test_source"; then :; else
|
||||
AS_ECHO(["$as_me: unable to parse test group: $[1]"]) >&2
|
||||
at_failed=:
|
||||
fi ;;])
|
||||
])# AT_CLEANUP
|
||||
|
||||
|
||||
|
@ -98,7 +98,14 @@ AT_CHECK_AT_TEST([Truth],
|
||||
[AT_CHECK([:], 0, [], [])])
|
||||
|
||||
AT_CHECK_AT_TEST([Fallacy],
|
||||
[AT_CHECK([false], ignore, [], [])])
|
||||
[AT_CHECK([false], [], [], [])],
|
||||
[], [1], [], [ignore],
|
||||
[AT_CHECK([grep failed micro-suite.log], [], [ignore])])
|
||||
|
||||
AT_CHECK_AT_TEST([Skip],
|
||||
[AT_CHECK([exit 77], 0, [], [])],
|
||||
[], [], [], [],
|
||||
[AT_CHECK([grep skipped micro-suite.log], [], [ignore])])
|
||||
|
||||
AT_CHECK_AT_TEST([Literal multiline command],
|
||||
[AT_CHECK([echo Auto'
|
||||
|
Loading…
Reference in New Issue
Block a user