From 00d80808b5aa0ca66eccb7653a044b9333c449fa Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Mon, 16 Aug 2010 21:14:20 +0200 Subject: [PATCH] Fix Autotest --errexit to exit after XPASSing tests. * lib/autotest/general.m4 (AT_INIT) : Exit after an unexpected passing test if $at_errexit. * tests/autotest.at (errexit): Also try tests that xpass, skip, xfail, or fail hard. Signed-off-by: Ralf Wildenhues --- ChangeLog | 8 ++++++++ lib/autotest/general.m4 | 3 +++ tests/autotest.at | 33 +++++++++++++++++++++++++++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 356d78fca..fbc69db5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-08-16 Ralf Wildenhues + + Fix Autotest --errexit to exit after XPASSing tests. + * lib/autotest/general.m4 (AT_INIT) : + Exit after an unexpected passing test if $at_errexit. + * tests/autotest.at (errexit): Also try tests that xpass, skip, + xfail, or fail hard. + 2010-08-14 Eric Blake AC_INIT: allow bugreport to contain '?' diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index a24834232..ef76e63cd 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -1257,6 +1257,9 @@ _ATEOF # or the success was unexpected. if $at_debug_p || test $at_res = xpass; then at_fn_create_debugging_script + if test $at_res = xpass && $at_errexit; then + echo stop > "$at_stop_file" + fi else if test -d "$at_group_dir"; then find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \; diff --git a/tests/autotest.at b/tests/autotest.at index b617db6dd..04524a50f 100644 --- a/tests/autotest.at +++ b/tests/autotest.at @@ -368,12 +368,41 @@ AT_CHECK_AT_TEST([errexit], [AT_CHECK([false]) AT_CLEANUP AT_SETUP([test that should not be run]) - AT_CHECK([:])], + AT_CHECK([:]) + AT_CLEANUP + AT_SETUP([xpassing test]) + AT_XFAIL_IF([:]) + AT_CHECK([:]) + AT_CLEANUP + AT_SETUP([another test that should not be run]) + AT_CHECK([:]) + AT_CLEANUP + AT_SETUP([skipping test]) + AT_CHECK([exit 77]) + AT_CLEANUP + AT_SETUP([xfailing test]) + AT_XFAIL_IF([:]) + AT_CHECK([false]) + AT_CLEANUP + AT_SETUP([a test that should be run]) + AT_CLEANUP + AT_SETUP([hard failure]) + AT_XFAIL_IF([:]) + AT_CHECK([exit 99]) + AT_CLEANUP + AT_SETUP([yet another test that should not be run])], [], [1], [stdout], [stderr], [], [AT_CHECK([test -f micro-suite.log], [1]) touch micro-suite.log # shut up AT_CAPTURE_FILE. AT_CHECK([grep "should not be run" stdout], [1]) - AT_CHECK([grep "1 .* inhibited subsequent" stderr], [], [ignore])], + AT_CHECK([grep "1 .* inhibited subsequent" stderr], [], [ignore]) + AT_CHECK([$CONFIG_SHELL ./micro-suite --errexit 3-], [1], [stdout], [stderr]) + AT_CHECK([grep "should not be run" stdout], [1]) + AT_CHECK([grep "1 .* inhibited subsequent" stderr], [], [ignore]) + AT_CHECK([$CONFIG_SHELL ./micro-suite --errexit 5-], [1], [stdout], [stderr]) + AT_CHECK([grep "should be run" stdout], [0], [ignore]) + AT_CHECK([grep "should not be run" stdout], [1]) + AT_CHECK([grep "inhibited subsequent" stderr], [], [ignore])], [--errexit]) AT_CHECK_AT_TEST([unquoted output], -- 2.47.3