]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Autotest: do not use shell functions for individual tests.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 17 Oct 2007 19:12:36 +0000 (21:12 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 17 Oct 2007 19:12:36 +0000 (21:12 +0200)
* 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.

ChangeLog
lib/autotest/general.m4
tests/autotest.at

index c1b1241caa4d27313e249e779da39c8ad567b3bf..76124f0880c85c19cee5ccc967c5f9628ab9a2ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
 
index 52fa8ef3a1a21f5940053951e8bf5931f0e8511c..9c95afdd78597f0d077e8dde821b86db6de6668d 100644 (file)
@@ -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
 
 
index 2a339e1143bc6a3f55323c5673780ed2ea8b8c06..1f03a8f7426de3f0a8fa1cf9a81a0382e50b8a99 100644 (file)
@@ -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'