autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

32-autotest-for-case.patch


From: DEMAILLE Akim
Subject: 32-autotest-for-case.patch
Date: Mon, 20 Nov 2000 10:18:26 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        Transform Autotest so that instead of

        ...
        if run test 42
        prologue tests
        check 42 a
        check 42 b
        epilogue tests
        fi

        if run test 43
        prologue tests
        check 43 a
        epilogue tests
        fi
        ...

        it builds

        for test in $tests
        do
        case $test in

        ...

        42)
        prologue tests
        check 42 a
        check 42 b
        epilogue tests
        ;;
        43)
        prologue tests
        check 43
        epilogue tests
        ;;
        ...

        esac
        done

        As a known side effect, currently any code outside
        AT_SETUP/AT_CLEANUP is discarded.

        * acgeneral.m4 (_m4_divert(KILL)): Move to...
        * m4sugar.m4: here.
        * tests/atgeneral.m4 (AT_INIT): Use m4_divert_push/pop instead of
        m4_divert.
        Put all the tests inside a for;case.
        Define TESTS.
        (AT_SETUP, AT_CLEANUP): Open/close each case.

Index: acgeneral.m4
--- acgeneral.m4 Sat, 18 Nov 2000 15:36:51 +0100 akim (ace/27_acgeneral. 
1.169.8.95 644)
+++ acgeneral.m4 Sat, 18 Nov 2000 15:42:22 +0100 akim (ace/27_acgeneral. 
1.169.8.95 644)
@@ -109,8 +109,6 @@
 # DIVERSION-NAME which is supposed to be an actual diversion number.
 # Of course it would be nicer to use m4_case here, instead of zillions
 # of little macros, but it then takes twice longer to run `autoconf'!
-m4_define([_m4_divert(KILL)],           -1)
-
 m4_define([_m4_divert(BINSH)],           0)
 m4_define([_m4_divert(REVISION)],        1)
 m4_define([_m4_divert(NOTICE)],          2)
Index: m4sugar.m4
--- m4sugar.m4 Sat, 18 Nov 2000 15:36:51 +0100 akim (ace/b/27_libm4.m4 1.35 644)
+++ m4sugar.m4 Sat, 18 Nov 2000 15:42:53 +0100 akim (ace/b/27_libm4.m4 1.35 644)
@@ -637,6 +637,9 @@ m4_define([_m4_divert],
        [m4_indir([_m4_divert($1)])],
        [$1])])

+# KILL is only used to suppress output.
+m4_define([_m4_divert(KILL)],           -1)
+

 # m4_divert_push(DIVERSION-NAME)
 # ------------------------------
Index: tests/atgeneral.m4
--- tests/atgeneral.m4 Sat, 18 Nov 2000 15:36:51 +0100 akim 
(ace/b/19_atgeneral. 1.21 644)
+++ tests/atgeneral.m4 Sat, 18 Nov 2000 16:16:46 +0100 akim 
(ace/b/19_atgeneral. 1.21 644)
@@ -55,8 +55,8 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und

 # Use of diversions:
 #  0 - overall initialization; for each test group: skipping and cleanups;
-#  1 - for each test group: proper code, to reinsert between cleanups;
-#  2 - overall wrap up: generation of debugging scripts and statistics.
+#  2 - for each test group: proper code, to reinsert between cleanups;
+#  3 - overall wrap up: generation of debugging scripts and statistics.


 # AT_LINE
@@ -71,7 +71,8 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und
 # Begin testing suite, using PROGRAM to check version.  The search path
 # should be already preset so the proper executable will be selected.
 AT_DEFINE([AT_INIT],
-[AT_DEFINE([AT_ordinal], 0)
+[m4_divert_push(0)dnl
+AT_DEFINE([AT_ordinal], 0)
 . ./atconfig
 # Snippet (3
 # -e sets to true
@@ -153,7 +154,16 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und

 at_failed_list=
 at_ignore_count=0
-m4_divert(2)[]dnl
+m4_divert_push(1)dnl
+
+: ${tests="$TESTS"}
+for test in $tests
+do
+  case $test in
+m4_divert_pop[]dnl
+m4_divert_push(3)[]dnl
+  esac
+done

 # Wrap up the testing suite with summary statistics.

@@ -227,7 +237,11 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und
 fi

 exit 0
-m4_divert[]dnl
+m4_divert_pop()dnl
+m4_divert_push(1)dnl
+m4_divert_push([KILL])dnl
+m4_wrap([m4_divert_text(0,
+                        [TESTS="m4_for([i], 1, AT_ordinal, 1, [i ])"])])dnl
 ])# AT_INIT


@@ -241,21 +255,23 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und
 m4_pushdef([AT_data_files], )
 m4_pushdef([AT_data_expout], )
 m4_pushdef([AT_data_experr], )
-if $at_stop_on_error && test -n "$at_failed_list"; then :; else
-m4_divert(1)[]dnl
-  echo AT_LINE > at-check-line
-  echo AT_LINE > at-setup-line
-  if $at_verbose; then
-    echo 'testing $1'
-    echo $at_n "     $at_c"
-  fi
-  if $at_verbose; then
-    echo "AT_ordinal. $srcdir/AT_LINE..."
-  else
-    echo $at_n "m4_substr(AT_ordinal. $srcdir/AT_LINE                          
  , 0, 30)[]$at_c"
-  fi
-  if test -z "$at_skip_mode"; then
-    (
+m4_divert_pop()dnl
+  AT_ordinal )
+    if $at_stop_on_error && test -n "$at_failed_list"; then :; else
+m4_divert(2)[]dnl
+    echo AT_LINE > at-check-line
+    echo AT_LINE > at-setup-line
+    if $at_verbose; then
+       echo 'testing $1'
+       echo $at_n "     $at_c"
+    fi
+    if $at_verbose; then
+       echo "AT_ordinal. $srcdir/AT_LINE..."
+    else
+       echo $at_n "m4_substr(AT_ordinal. $srcdir/AT_LINE                       
     , 0, 30)[]$at_c"
+    fi
+    if test -z "$at_skip_mode"; then
+       (
 [#] Snippet (d[]AT_ordinal[](
 [#] Testing $1
 [#] Snippet )d[]AT_ordinal[])
@@ -273,39 +289,41 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und
 AT_DEFINE([AT_CLEANUP],
 $at_traceoff
 [[#] Snippet )s[]AT_ordinal[])
-    )
-    at_status=$?
-    $at_verbose &&
-      echo $at_n "     AT_ordinal. $srcdir/`cat at-setup-line`: $at_c"
-    case $at_status in
-      0) echo ok
-         ;;
-      77) echo "ignored near \``cat at-check-line`'"
-          at_ignore_count=`expr $at_ignore_count + 1`
-          ;;
-      *) echo "FAILED near \``cat at-check-line`'"
-         at_failed_list="$at_failed_list AT_ordinal"
-         ;;
-    esac
-  else
-     echo 'ignored (skipped)'
-     at_ignore_count=`expr $at_ignore_count + 1`
-  fi
-  at_test_count=AT_ordinal
-  if $at_stop_on_error && test -n "$at_failed_list"; then :; else
-m4_divert(0)[]dnl
+       )
+       at_status=$?
+       $at_verbose &&
+         echo $at_n "     AT_ordinal. $srcdir/`cat at-setup-line`: $at_c"
+       case $at_status in
+         0) echo ok
+            ;;
+         77) echo "ignored near \``cat at-check-line`'"
+             at_ignore_count=`expr $at_ignore_count + 1`
+             ;;
+         *) echo "FAILED near \``cat at-check-line`'"
+            at_failed_list="$at_failed_list AT_ordinal"
+            ;;
+       esac
+      else
+        echo 'ignored (skipped)'
+        at_ignore_count=`expr $at_ignore_count + 1`
+      fi
+      at_test_count=AT_ordinal
+      if $at_stop_on_error && test -n "$at_failed_list"; then :; else
+m4_divert(1)[]dnl
 [#] Snippet (c[]AT_ordinal[](

-rm ifelse([AT_data_files$1], , [-f], [-rf[]AT_data_files[]ifelse($1, , , [ 
$1])]) stdout stderr[]AT_data_expout[]AT_data_experr
-[#] Snippet )c[]AT_ordinal[])
-m4_undivert(1)[]dnl
     rm ifelse([AT_data_files$1], , [-f], [-rf[]AT_data_files[]ifelse($1, , , [ 
$1])]) stdout stderr[]AT_data_expout[]AT_data_experr
-  fi
-fi
-m4_popdef([AT_data_experr])
-m4_popdef([AT_data_expout])
-m4_popdef([AT_data_files])
-m4_popdef([AT_group_description])[]dnl
+    [#] Snippet )c[]AT_ordinal[])
+m4_undivert(2)[]dnl
+    rm ifelse([AT_data_files$1], , [-f], [-rf[]AT_data_files[]ifelse($1, , , [ 
$1])]) stdout stderr[]AT_data_expout[]AT_data_experr
+      fi
+    fi
+    ;;
+
+m4_popdef([AT_data_experr])dnl
+m4_popdef([AT_data_expout])dnl
+m4_popdef([AT_data_files])dnl
+m4_divert_push([KILL])dnl
 ])# AT_CLEANUP


@@ -378,6 +396,3 @@ m4_define([AT_UNDEFINE], m4_defn([m4_und
 fi
 $at_traceon
 ])# AT_CHECK
-
-
-m4_divert(0)dnl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]