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 $?.
This commit is contained in:
Akim Demaille 2000-11-29 10:12:05 +00:00
parent acbcc5f2b7
commit a8c122d0f2
13 changed files with 130 additions and 99 deletions

View File

@ -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)

View 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

View 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)])

View 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)])

View 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

View File

@ -1,10 +1,6 @@
# -*- autoconf -*-
cat <<EOF
Autoconf base layer.
EOF
AT_BANNER([Autoconf base layer.])
## ------------------------------- ##

View 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

View File

@ -1,10 +1,6 @@
# -*- Autoconf -*-
cat <<EOF
M4sh.
EOF
AT_BANNER([M4sh.])
## ----------------------------- ##

View File

@ -1,10 +1,6 @@
# -*- Autoconf -*-
cat <<EOF
M4sugar.
EOF
AT_BANNER([M4sugar.])
## -------------- ##
## m4_text_wrap. ##

View File

@ -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

View 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.

View 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. ##

View 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