]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Provide a means to display banners in the test suite.
authorAkim Demaille <akim@epita.fr>
Wed, 29 Nov 2000 10:12:05 +0000 (10:12 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 29 Nov 2000 10:12:05 +0000 (10:12 +0000)
* tests/atgeneral.m4 (AT_INIT): Initialize AT_banner_ordinal.
Execute the epilogue of the tests only if a test was run.
Don't built the value of `at_tests_all' by a for loop: expand
AT_TESTS_ALL.
(AT_SETUP): Build AT_TESTS_ALL.
(AT_BANNER): New.
Adjust all the former banners to use it.
(AT_CHECK): Don't trace the decoding of $?.

13 files changed:
ChangeLog
lib/autotest/general.m4
lib/m4sugar/m4sugar.m4
m4sugar.m4
tests/atgeneral.m4
tests/base.at
tests/compile.at
tests/m4sh.at
tests/m4sugar.at
tests/mktests.sh
tests/suite.at
tests/tools.at
tests/torture.at

index ed86b73fdab1c0623bbd301271bbd5c9fa07191f..2f391650e4a137206143d6f3ded4900d2b0be102 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2000-11-29  Akim Demaille  <akim@epita.fr>
+
+       Provide a means to display banners in the test suite.
+
+       * tests/atgeneral.m4 (AT_INIT): Initialize AT_banner_ordinal.
+       Execute the epilogue of the tests only if a test was run.
+       Don't built the value of `at_tests_all' by a for loop: expand
+       AT_TESTS_ALL.
+       (AT_SETUP): Build AT_TESTS_ALL.
+       (AT_BANNER): New.
+       Adjust all the former banners to use it.
+       (AT_CHECK): Don't trace the decoding of $?.
+
 2000-11-29  Akim Demaille  <akim@epita.fr>
 
        * tests/atgeneral.m4 (AT_DEFINE, AT_UNDEFINE, AT_SHIFT)
index a8a78b9515d8e73ca5b1e27c7c50212edb98d0c0..37b6d2ca3e47e61fde7150d3734b6bea3ff273b2 100644 (file)
@@ -93,6 +93,7 @@ m4_define([AT_LINE],
 # should be already preset so the proper executable will be selected.
 m4_define([AT_INIT],
 [m4_define([AT_ordinal], 0)
+m4_define([AT_banner_ordinal], 0)
 m4_divert_push([DEFAULT])dnl
 #! /bin/sh
 
@@ -225,20 +226,25 @@ do
 dnl Tests inserted here (TESTS).
 m4_divert([TAIL])[]dnl
   esac
-  at_test_count=`expr 1 + $at_test_count`
-  $at_verbose $at_n "     $at_test. $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_test"
-       $at_stop_on_error && break
-       ;;
+  case $at_test in
+    banner-*) ;;
+    *)
+      at_test_count=`expr 1 + $at_test_count`
+      $at_verbose $at_n "     $at_test. $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_test"
+           $at_stop_on_error && break
+           ;;
+      esac
+      $at_debug || rm -rf $at_data_files
+      ;;
   esac
-  $at_debug || rm -rf $at_data_files
 done
 
 # Wrap up the testing suite with summary statistics.
@@ -296,7 +302,7 @@ exit 0
 m4_divert_pop()dnl
 m4_wrap([m4_divert_text([DEFAULT],
                         [# List of the tests.
-at_tests_all="m4_for([i], 1, AT_ordinal, 1, [i ])"])])dnl
+at_tests_all="AT_TESTS_ALL "])])dnl
 ])# AT_INIT
 
 
@@ -307,11 +313,12 @@ at_tests_all="m4_for([i], 1, AT_ordinal, 1, [i ])"])])dnl
 # The group is testing what DESCRIPTION says.
 m4_define([AT_SETUP],
 [m4_define([AT_ordinal], m4_incr(AT_ordinal))
+m4_append([AT_TESTS_ALL], [ ]m4_defn([AT_ordinal]))
 m4_divert_text([HELP],
                [m4_format([ %3d: %-15s %s], AT_ordinal, AT_LINE, [$1])])
 m4_pushdef([AT_data_files], [stdout stderr ])
 m4_divert_push([TESTS])dnl
-  AT_ordinal )
+  AT_ordinal ) [#] AT_ordinal. AT_LINE: $1
 dnl Here will be inserted the definition of at_data_files.
 m4_divert([TEST])[]dnl
     rm -rf $at_data_files
@@ -371,6 +378,24 @@ m4_divert_pop()dnl
 ])# AT_CLEANUP
 
 
+# AT_BANNER(TEXT)
+# ---------------
+# Output TEXT without any shell expansion.
+m4_define([AT_BANNER],
+[m4_define([AT_banner_ordinal], m4_incr(AT_banner_ordinal))
+m4_append([AT_TESTS_ALL], [ banner-]m4_defn([AT_banner_ordinal]))
+m4_divert_push([TESTS])dnl
+  banner-AT_banner_ordinal ) [#] Banner AT_banner_ordinal. AT_LINE
+    cat <<\_ATEOF
+
+$1
+
+_ATEOF
+    ;;
+m4_divert_pop()dnl
+])# AT_BANNER
+
+
 # AT_DATA(FILE, CONTENTS)
 # -----------------------
 # Initialize an input data FILE with given CONTENTS, which should end with
@@ -403,7 +428,8 @@ $at_check_stds && exec 5>&1 6>&2 1>stdout 2>stderr
 $at_traceon
 $1
 m4_ifval([$2],
-[at_status=$?
+         [at_status=$?
+$at_traceoff
 if test $at_status != $2; then
   $at_verbose "Exit code was $at_status, expected $2" >&6
 dnl Maybe there was an important message to read before it died.
@@ -412,8 +438,8 @@ dnl Preserve exit code 77.
   test $at_status = 77 && exit 77
   exit 1
 fi
-])dnl
-$at_traceoff
+],
+         [$at_traceoff])dnl
 if $at_check_stds; then
 dnl Restore stdout to fd1 and stderr to fd2.
   exec 1>&5 2>&6
index 95e18cc8ea03cf1cbb5e555dfc2f68b6e9901bca..d468b4bf853b41ffcf19c2a17706fbdcd54f385e 100644 (file)
@@ -1,7 +1,7 @@
 divert(-1)#                                                  -*- Autoconf -*-
 # This file is part of Autoconf.
-# Base m4 layer.
-# Requires GNU m4.
+# Base M4 layer.
+# Requires GNU M4.
 # Copyright 1999, 2000 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -57,7 +57,7 @@ changequote([, ])
 # equivalent functionality by core dumping because of the
 # long macros we define.
 ifdef([__gnu__], ,
-[errprint(Autoconf requires GNU m4. Install it before installing Autoconf or
+[errprint(M4sugar requires GNU M4. Install it before installing M4sugar or
 set the M4 environment variable to its path name.)
 m4exit(2)])
 
index 95e18cc8ea03cf1cbb5e555dfc2f68b6e9901bca..d468b4bf853b41ffcf19c2a17706fbdcd54f385e 100644 (file)
@@ -1,7 +1,7 @@
 divert(-1)#                                                  -*- Autoconf -*-
 # This file is part of Autoconf.
-# Base m4 layer.
-# Requires GNU m4.
+# Base M4 layer.
+# Requires GNU M4.
 # Copyright 1999, 2000 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -57,7 +57,7 @@ changequote([, ])
 # equivalent functionality by core dumping because of the
 # long macros we define.
 ifdef([__gnu__], ,
-[errprint(Autoconf requires GNU m4. Install it before installing Autoconf or
+[errprint(M4sugar requires GNU M4. Install it before installing M4sugar or
 set the M4 environment variable to its path name.)
 m4exit(2)])
 
index a8a78b9515d8e73ca5b1e27c7c50212edb98d0c0..37b6d2ca3e47e61fde7150d3734b6bea3ff273b2 100644 (file)
@@ -93,6 +93,7 @@ m4_define([AT_LINE],
 # should be already preset so the proper executable will be selected.
 m4_define([AT_INIT],
 [m4_define([AT_ordinal], 0)
+m4_define([AT_banner_ordinal], 0)
 m4_divert_push([DEFAULT])dnl
 #! /bin/sh
 
@@ -225,20 +226,25 @@ do
 dnl Tests inserted here (TESTS).
 m4_divert([TAIL])[]dnl
   esac
-  at_test_count=`expr 1 + $at_test_count`
-  $at_verbose $at_n "     $at_test. $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_test"
-       $at_stop_on_error && break
-       ;;
+  case $at_test in
+    banner-*) ;;
+    *)
+      at_test_count=`expr 1 + $at_test_count`
+      $at_verbose $at_n "     $at_test. $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_test"
+           $at_stop_on_error && break
+           ;;
+      esac
+      $at_debug || rm -rf $at_data_files
+      ;;
   esac
-  $at_debug || rm -rf $at_data_files
 done
 
 # Wrap up the testing suite with summary statistics.
@@ -296,7 +302,7 @@ exit 0
 m4_divert_pop()dnl
 m4_wrap([m4_divert_text([DEFAULT],
                         [# List of the tests.
-at_tests_all="m4_for([i], 1, AT_ordinal, 1, [i ])"])])dnl
+at_tests_all="AT_TESTS_ALL "])])dnl
 ])# AT_INIT
 
 
@@ -307,11 +313,12 @@ at_tests_all="m4_for([i], 1, AT_ordinal, 1, [i ])"])])dnl
 # The group is testing what DESCRIPTION says.
 m4_define([AT_SETUP],
 [m4_define([AT_ordinal], m4_incr(AT_ordinal))
+m4_append([AT_TESTS_ALL], [ ]m4_defn([AT_ordinal]))
 m4_divert_text([HELP],
                [m4_format([ %3d: %-15s %s], AT_ordinal, AT_LINE, [$1])])
 m4_pushdef([AT_data_files], [stdout stderr ])
 m4_divert_push([TESTS])dnl
-  AT_ordinal )
+  AT_ordinal ) [#] AT_ordinal. AT_LINE: $1
 dnl Here will be inserted the definition of at_data_files.
 m4_divert([TEST])[]dnl
     rm -rf $at_data_files
@@ -371,6 +378,24 @@ m4_divert_pop()dnl
 ])# AT_CLEANUP
 
 
+# AT_BANNER(TEXT)
+# ---------------
+# Output TEXT without any shell expansion.
+m4_define([AT_BANNER],
+[m4_define([AT_banner_ordinal], m4_incr(AT_banner_ordinal))
+m4_append([AT_TESTS_ALL], [ banner-]m4_defn([AT_banner_ordinal]))
+m4_divert_push([TESTS])dnl
+  banner-AT_banner_ordinal ) [#] Banner AT_banner_ordinal. AT_LINE
+    cat <<\_ATEOF
+
+$1
+
+_ATEOF
+    ;;
+m4_divert_pop()dnl
+])# AT_BANNER
+
+
 # AT_DATA(FILE, CONTENTS)
 # -----------------------
 # Initialize an input data FILE with given CONTENTS, which should end with
@@ -403,7 +428,8 @@ $at_check_stds && exec 5>&1 6>&2 1>stdout 2>stderr
 $at_traceon
 $1
 m4_ifval([$2],
-[at_status=$?
+         [at_status=$?
+$at_traceoff
 if test $at_status != $2; then
   $at_verbose "Exit code was $at_status, expected $2" >&6
 dnl Maybe there was an important message to read before it died.
@@ -412,8 +438,8 @@ dnl Preserve exit code 77.
   test $at_status = 77 && exit 77
   exit 1
 fi
-])dnl
-$at_traceoff
+],
+         [$at_traceoff])dnl
 if $at_check_stds; then
 dnl Restore stdout to fd1 and stderr to fd2.
   exec 1>&5 2>&6
index cdfc18d6a00c9e9c0fd4168185622d60e755c788..16e74040785ab3d17a960ecdf7e60f01073bf407 100644 (file)
@@ -1,10 +1,6 @@
 #                                                      -*- autoconf -*-
 
-cat <<EOF
-
-Autoconf base layer.
-
-EOF
+AT_BANNER([Autoconf base layer.])
 
 
 ## ------------------------------- ##
index 7f934703db222dcfe2f3f48fe84f1d0e85210c95..10582741ca7b4d4f378850063a69db80351481d6 100644 (file)
@@ -1,10 +1,6 @@
 #                                                      -*- autoconf -*-
 
-cat <<EOF
-
-Low level compiling/preprocessing macros.
-
-EOF
+AT_BANNER([Low level compiling/preprocessing macros.])
 
 # Since the macros which compile are required by most tests, check
 # them first.  But remember that looking for a compiler is even more
index 1d4ced6ebc172951c2426768bd885c7373ad2d6a..5fdd49a0b5d66b8fb42853d02f109ee822874a42 100644 (file)
@@ -1,10 +1,6 @@
 #                                                      -*- Autoconf -*-
 
-cat <<EOF
-
-M4sh.
-
-EOF
+AT_BANNER([M4sh.])
 
 
 ## ----------------------------- ##
index 9b49c238dbd6ddc80b16c786df51545af200cbbf..560b4730ce16c37716ecf5802e9e01b798df640c 100644 (file)
@@ -1,10 +1,6 @@
 #                                                      -*- Autoconf -*-
 
-cat <<EOF
-
-M4sugar.
-
-EOF
+AT_BANNER([M4sugar.])
 
 ## -------------- ##
 ## m4_text_wrap.  ##
index bddb8517ec59b6549399b04c9902b89f98bbf8fe..a09d84462d4dd6bd456ac9536017fbdfd2201160 100755 (executable)
@@ -124,12 +124,7 @@ syntax_exclude_egrep=`echo "$exclude_list$syntax_exclude_list" | tr '
 sed 's/^ *//' >syntax.tat <<MK_EOF
 # Generated by mktests.sh, do not edit by hand.                -*- autoconf -*-
 
-cat <<\EOF
-
-Syntax of macros and completeness of header templates.
-
-EOF
-
+AT_BANNER([Syntax of macros and completeness of header templates.])
 
 MK_EOF
 
@@ -186,12 +181,7 @@ update_exclude_egrep=`echo "$exclude_list$update_exclude_list" | tr '
 sed 's/^ *//' >update.tat <<MK_EOF
 # Generated by mktests.sh, do not edit by hand.                -*- autoconf -*-
 
-cat <<EOF
-
-Checking that autoupdated configure.in are sane.
-
-EOF
-
+AT_BANNER([Checking that autoupdated configure.in are sane.])
 
 MK_EOF
 
index 58abac105fdd7f2527d5516fde76e8f94dede6df..c7402fbf651eb0365c410f664b4fffc0c1fb698c 100644 (file)
@@ -8,10 +8,9 @@
 
 AT_INIT([autoconf])
 
-cat <<EOF
-Some tests might be ignored if you don't have the software which the
-macros are supposed to test (e.g., a Fortran compiler).
-EOF
+AT_BANNER(
+[Some tests might be ignored if you don't have the software which the
+macros are supposed to test (e.g., a Fortran compiler).])
 
 # Run the tests from the lowest level to the highest level, and from
 # the most selective to the easiest.
index da3f0c2e45090096e4f622deb1153c91f9c8abaa..63725bab19faf34137ada86df8969c5985e69a43 100644 (file)
@@ -1,11 +1,6 @@
 #                                                      -*- autoconf -*-
 
-cat <<EOF
-
-Executables (autoheader, autoupdate...)
-
-EOF
-
+AT_BANNER([Executables (autoheader, autoupdate...).])
 
 ## -------------------------------------------------------- ##
 ## Check that the shell scripts are syntactically correct.  ##
index 35bb43b5a51b3f35df41f6498e8221e060bccb2c..e066ba2533018446cefd627188dee5b59fed655d 100644 (file)
@@ -1,23 +1,19 @@
 #                                                      -*- autoconf -*-
 
-cat <<\EOF
-
-Testing config.status.
+AT_BANNER([[Testing config.status.
 
 ## ---------------------------------------------------------------- ##
 ## This section of torture tests is trying to make Autoconf produce ##
 ## failing `configure' scripts, which must never happen.  If one of ##
 ## these tests ever fails, it is extremely important that you       ##
 ## report the failure to bug-autoconf@gnu.org.                      ##
-## ---------------------------------------------------------------- ##
+## ---------------------------------------------------------------- ##]])
 
-EOF
 
 ## ---------------------------------------------- ##
 ## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS.  ##
 ## ---------------------------------------------- ##
 
-
 AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
 
 AT_DATA(configure.in,
@@ -59,11 +55,12 @@ AT_CLEANUP(header file link command header.in file.in link.in command.in configu
 
 
 
-## ------------------------------------------------------ ##
-## Check that config.status detects missing input files.  ##
-## ------------------------------------------------------ ##
+## ------------------- ##
+## Missing templates.  ##
+## ------------------- ##
 
-AT_SETUP([missing templates])
+# Check that config.status detects missing input files
+AT_SETUP([Missing templates])
 
 AT_DATA(configure.in,
 [[AC_INIT
@@ -83,17 +80,18 @@ AT_CLEANUP(configure config.status config.log config.cache config.h defs)
 
 
 
-## ------------------------------------------------------ ##
-## Check that `configure' and `config.status' honor their ##
-## interface.                                             ##
-## ------------------------------------------------------ ##
+## ---------------------- ##
+## configure invocation.  ##
+## ---------------------- ##
 
+# Check that `configure' and `config.status' honor their interface.
+#
 # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
 # and verify that (i) `configure' correctly receives the arguments and
 # (ii) correctly passes them to `config.status', which we check by
 # running `config.status --recheck'.
 
-AT_SETUP([command line interface])
+AT_SETUP([configure invocation])
 
 AT_DATA(configure.in,
 [[AC_INIT