[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFA] Validate configure script syntax
From: |
Paolo Bonzini |
Subject: |
[RFA] Validate configure script syntax |
Date: |
Wed, 03 Dec 2003 12:34:12 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021226 Debian/1.2.1-9 |
This improves the testing even for tests that are skipped or that do not
actually run config.status. Unfortunately it wildly increases (by
almost 300k) the size of the testsuite script, so I'd understand a
rejection.
Paolo
2003-12-03 Paolo Bonzini <address@hidden>
* tests/local.at (AT_CHECK_SHELL_SYNTAX,
AT_DETECT_SH_N, AT_CHECK_PERL_SYNTAX): Extracted
from tools.at.
(AT_CHECK_AUTOCONF): Use AT_CHECK_SHELL_SYNTAX
on the generated configure file.
* tests/tools.at (Syntax of the shell scripts):
Simplify using AT_CHECK_SHELL_SYNTAX.
* tests/tools.at (Syntax of the Perl scripts):
Remove definition of AT_CHECK_PERL_SYNTAX.
2003-11-26 Paolo Bonzini <address@hidden>
* lib/m4sugar/m4sh.m4 (_AS_BOURNE_COMPATIBLE):
Index: autoconf/tests/local.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/local.at,v
retrieving revision 1.3
diff -u -r1.3 local.at
--- autoconf/tests/local.at 27 Aug 2003 15:14:04 -0000 1.3
+++ autoconf/tests/local.at 3 Dec 2003 10:34:09 -0000
@@ -26,6 +26,45 @@
AT_TESTED([autom4te autoconf autoheader autoupdate autoreconf ifnames])
+## ---------------- ##
+## Testing syntax. ##
+## ---------------- ##
+
+m4_define([AT_CHECK_SHELL_SYNTAX],
+[AS_REQUIRE([AT_DETECT_SH_N])dnl
+AS_IF([test $at_have_sh_n = yes], [AT_CHECK([/bin/sh -n $1], 0)], [$2])])
+
+m4_defun([AT_DETECT_SH_N],
+[# A script that never returns. We don't care that it never returns,
+# broken /bin/sh loop equally with `false', but it makes it easier to
+# test the robustness in a good environment: just remove the `-n'.
+AT_DATA([endless.sh],
+[[while :
+do
+ :
+done
+]])
+
+# A script in charge of testing `/bin/sh -n'.
+AT_DATA([syntax.sh],
+[(/bin/sh -n endless.sh) &
+sleep 2
+if kill $! >/dev/null 2>&1; then
+ # We managed to kill the child, which means that we probably
+ # can't trust `/bin/sh -n', hence the test failed.
+ AS_EXIT(1)
+fi
+])
+
+AS_IF([/bin/sh ./syntax.sh 2>&1 > /dev/null],
+ at_have_sh_n=yes, at_have_sh_n=no)
+
+rm endless.sh syntax.sh])
+
+m4_define([AT_CHECK_PERL_SYNTAX],
+[AT_CHECK([autom4te_perllibdir=$abs_top_srcdir/lib $PERL -c
$abs_top_builddir/bin/$1],
+ 0, [], [ignore])])
+
## ------------------ ##
## Testing autom4te. ##
## ------------------ ##
@@ -219,7 +258,10 @@
# ----------------------------------------------------------
m4_define([AT_CHECK_AUTOCONF],
[AT_CHECK([autoconf $1],
- [$2], [$3], [$4])])
+ [$2], [$3], [$4])
+if test -s configure; then
+ AT_CHECK_SHELL_SYNTAX(configure)
+fi])
# AT_CHECK_AUTOHEADER(ARGS, [EXIT-STATUS = 0], STDOUT, STDERR)
@@ -239,7 +281,10 @@
[AT_CHECK([top_srcdir=$abs_top_srcdir ./configure $1],
[$2],
m4_default([$3], [ignore]), [$4],
- [{ echo "$srcdir/AT_LINE: config.log"; sed 's/^/> /' config.log; }
>>$at_group_log ])])
+ [{ echo "$srcdir/AT_LINE: config.log"; sed 's/^/> /' config.log; }
>>$at_group_log ])
+if test -s config.status; then
+ AT_CHECK_SHELL_SYNTAX(config.status)
+fi])])
# AT_CHECK_ENV
Index: autoconf/tests/tools.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/tools.at,v
retrieving revision 1.73
diff -u -r1.73 tools.at
--- autoconf/tests/tools.at 27 Nov 2003 10:04:14 -0000 1.73
+++ autoconf/tests/tools.at 3 Dec 2003 10:34:09 -0000
@@ -46,41 +46,17 @@
AT_SETUP([Syntax of the shell scripts])
-# A script that never returns. We don't care that it never returns,
-# broken /bin/sh loop equally with `false', but it makes it easier to
-# test the robustness in a good environment: just remove the `-n'.
-AT_DATA([endless.sh],
-[[while :
-do
- :
-done
-]])
-
-# A script in charge of testing `/bin/sh -n'.
-AT_DATA([syntax.sh],
-[[(/bin/sh -n endless.sh) &
-sleep 2
-if kill $! >/dev/null 2>&1; then
- # We managed to kill the child, which means that we probably
- # can't trust `/bin/sh -n', hence the test failed.
- exit 77
-fi
-]])
-
-# If we can't trust sh, just skip.
-AT_CHECK([/bin/sh ./syntax.sh])
-
# Specify the path to the tool, some shells don't honor PATH when
# running `sh PROG'.
-AT_CHECK([/bin/sh -n $abs_top_builddir/bin/autoconf], 0)
-AT_CHECK([/bin/sh -n $abs_top_builddir/tests/autoconf], 0)
-AT_CHECK([/bin/sh -n $abs_top_builddir/tests/testsuite], 0)
+AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/bin/autoconf], exit 77)
+AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/autoconf], exit 77)
+AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/testsuite], exit 77)
# These are not built, they are in the src tree.
-AT_CHECK([/bin/sh -n $abs_top_srcdir/config/install-sh], 0)
-AT_CHECK([/bin/sh -n $abs_top_srcdir/config/mkinstalldirs], 0)
-AT_CHECK([/bin/sh -n $abs_top_srcdir/config/missing], 0)
+AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/config/install-sh], exit 77)
+AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/config/mkinstalldirs], exit 77)
+AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/config/missing], exit 77)
AT_CLEANUP
@@ -92,14 +68,6 @@
## ---------------------------- ##
AT_SETUP([Syntax of the Perl scripts])
-
-# Perl says things like:
-# | % perl -c ./autom4te
-# | ./autom4te syntax OK
-# Ignore it, it might change between releases.
-m4_define([AT_CHECK_PERL_SYNTAX],
-[AT_CHECK([autom4te_perllibdir=$abs_top_srcdir/lib $PERL -c
$abs_top_builddir/bin/$1],
- 0, [], [ignore])])
AT_CHECK_PERL_SYNTAX([autoheader])
AT_CHECK_PERL_SYNTAX([autom4te])
- [RFA] Validate configure script syntax,
Paolo Bonzini <=