m4-patches
[Top][All Lists]
Advanced

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

/floppy/m4-patches/17-fyi-tests-m4.patch


From: Akim Demaille
Subject: /floppy/m4-patches/17-fyi-tests-m4.patch
Date: Mon, 27 Aug 2001 09:28:53 +0200

Yes, to be honest, I'm using M4 as a test bed for my test beds.

The idea that drove to the patch (and some of those upstream) are
related to a mail I sent some time ago to the Autoconf world:


     BTW, there is something I wish we had, because as a maintainer I have
     already been caught by such stupidities: a `make check' but on an
     _installed_ tree.  Am I the only one who had check and distcheck
     succeed, but the actual project be broken because... I forgot to
     install files, or some paths are wrong etc...

     My idea is that each package should provide runable versions its
     programs.  `autoconf' is a good example: bin/autoconf is _not_
     runable: you need to adjust the path to the _non installed_ files, set
     some magic envvar for autom4te to find its Perl lib files etc.  Up to
     now this was handled via some magic file setting the appropriate
     envvar (that's the case of Automake for instance with tests/defs), or
     via complex invocations (see autoconf/tests/atspecific.m4 which passes
     a zillion flags to autoconf, autoheader etc. at each invocation).

     My proposal is that there should be, say, tests/autoconf,
     tests/autoheader etc. which must be directly runable (_they_ perform
     the redirection to bin/autoconf etc.).  Then, no black magic is
     needed: the test suite just runs with a PATH that choses those first.

     Then, to check an installed tree, even if in `=inst/', you just need
     to adjust the PATH appropriately.  Et voila`.  The main point is that
     the test suite must not know it runs against uninstalled tools.

     I'm quite excited with this idea, and I would really love to hear
     comments about it.


Index: ChangeLog
from  Akim Demaille  <address@hidden>

        Let the test suite use a wrapper around the not installed m4 to
        pretend it is (installed).

        * bootstrap (aclocal.m4): Output AC_SUBST's and AM_CONDITIONAL's in
        such a way that m4 does not process them.
        * configure.in: The package name seems to be `m4', not `M4'.
        * tests/m4: New.
        * tests/atlocal.in (at_package, M4): Remove.
        * tests/testsuite.at, tests/others.at: Use m4, not $M4.

Index: bootstrap
--- bootstrap Fri, 24 Aug 2001 17:11:45 +0200 akim
+++ bootstrap Fri, 24 Aug 2001 18:13:17 +0200 akim
@@ -16,14 +16,18 @@
 done

 # Automake understands nothing to our aclocal and misses all its
-# AC_SUBST...
+# AC_SUBST...  Output them, but in a way that makes m4 ignore then.
 (
   set -e
   sed -n '1,/# Help Automake understand includes./p' aclocal.m4
-  echo "# It doesn't see AC_SUBSTs."
-  autoconf -t AC_SUBST:'AC_SUBST([$1])' | sort -u
-  echo "# It doesn't see AM_CONDITIONALs."
-  autoconf -t AM_CONDITIONAL:'AM_CONDITIONAL([$1])' | sort -u
+  echo "ifelse("
+  echo "  ["
+  echo "    # It doesn't see AC_SUBSTs."
+  autoconf -t AC_SUBST:'    AC_SUBST([$1])' | sort -u
+  echo "    # It doesn't see AM_CONDITIONALs."
+  autoconf -t AM_CONDITIONAL:'    AM_CONDITIONAL([$1])' | sort -u
+  echo "  ]"
+  echo ")"
 ) >aclocal.m4t
 mv aclocal.m4t aclocal.m4

Index: configure.in
--- configure.in Fri, 24 Aug 2001 17:11:45 +0200 akim
+++ configure.in Fri, 24 Aug 2001 18:55:48 +0200 akim
@@ -24,7 +24,7 @@
 m4_pattern_forbid([^jm_])
 m4_pattern_allow([^jm_cv_])

-AC_INIT([GNU M4], [1.4q], address@hidden)
+AC_INIT([GNU m4], [1.4q], address@hidden)
 AC_CONFIG_SRCDIR([src/m4.h])
 AC_CONFIG_AUX_DIR(config)
 AM_CONFIG_HEADER(config.h:config-h.in)
Index: tests/Makefile.am
--- tests/Makefile.am Fri, 24 Aug 2001 17:49:14 +0200 akim
+++ tests/Makefile.am Fri, 24 Aug 2001 17:57:28 +0200 akim
@@ -19,7 +19,7 @@
 # The next line is needed by `others.at:esyscmd'
 #  Ty Coon, President of Vice

-EXTRA_DIST = generate.awk atlocal.in \
+EXTRA_DIST = generate.awk atlocal.in m4 \
        $(OTHER_FILES) $(TESTSUITE_AT) $(TESTSUITE)

 DISTCLEANFILES       = atconfig atlocal
Index: tests/atlocal.in
--- tests/atlocal.in Sun, 19 Aug 2001 23:00:40 +0200 akim
+++ tests/atlocal.in Fri, 24 Aug 2001 18:11:09 +0200 akim
@@ -3,12 +3,6 @@
 # Configurable variable values for M4 test suite.
 # Copyright 2000, 2001 Free Software Foundation, Inc.

-# We overwrite at_package, because Autotest expects `M4', not `m4'.
-at_package='GNU m4'
-
-# See how GNU m4 should be run.  No options as default.
-test -z "$M4" &&
-  M4="${SHELL} $top_builddir/libtool --mode=execute $top_builddir/src/m4"
-
+# Some tests cannot be performed with all the configurations.
 address@hidden@
 address@hidden@
Index: tests/others.at
--- tests/others.at Fri, 24 Aug 2001 17:11:45 +0200 akim
+++ tests/others.at Fri, 24 Aug 2001 19:04:09 +0200 akim
@@ -626,7 +626,7 @@ m4: ../examples/include.m4: 6: Cannot op

 AT_SETUP([--module-directory: absolute path])

-AT_CHECK([M4PATH=$top_srcdir $M4 -M `cd $top_builddir/modules; pwd` -m load -d 
modules/modtest.m4], 0,
+AT_CHECK([M4PATH=$top_srcdir m4 -M `cd $top_builddir/modules; pwd` -m load -d 
modules/modtest.m4], 0,
 [[Test module loaded.
 Test module called.
 Dumpdef: .
@@ -645,7 +645,7 @@ Dumpdef: .

 AT_SETUP([modpath2])

-AT_CHECK([M4PATH=$top_srcdir LTDL_LIBRARY_PATH=$top_builddir/modules $M4 -m 
load -d modules/modtest.m4], 0,
+AT_CHECK([M4PATH=$top_srcdir LTDL_LIBRARY_PATH=$top_builddir/modules m4 -m 
load -d modules/modtest.m4], 0,
 [[Test module loaded.
 Test module called.
 Dumpdef: .
@@ -669,7 +669,7 @@ Dumpdef: .
 Dumpdef: dumpdef(`test').
 ]])

-AT_CHECK([$M4 -m load -m modtest -M $top_builddir/modules -d in], 0,
+AT_CHECK([m4 -m load -m modtest -M $top_builddir/modules -d in], 0,
 [[Test module called.
 Dumpdef: .
 ]],
@@ -687,7 +687,7 @@ Dumpdef: .

 AT_SETUP([M4MODPATH: absolute path])

-AT_CHECK([M4PATH=$top_srcdir M4MODPATH=`cd $top_builddir/modules; pwd` $M4 -m 
load -d modules/modtest.m4], 0,
+AT_CHECK([M4PATH=$top_srcdir M4MODPATH=`cd $top_builddir/modules; pwd` m4 -m 
load -d modules/modtest.m4], 0,
 [[Test module loaded.
 Test module called.
 Dumpdef: .
@@ -706,7 +706,7 @@ Dumpdef: .

 AT_SETUP([modtest])

-AT_CHECK([M4PATH=$top_srcdir $M4 -M $top_builddir/modules -m load -d 
modules/modtest.m4], 0,
+AT_CHECK([M4PATH=$top_srcdir m4 -M $top_builddir/modules -m load -d 
modules/modtest.m4], 0,
 [[Test module loaded.
 Test module called.
 Dumpdef: .
Index: tests/testsuite.at
--- tests/testsuite.at Fri, 24 Aug 2001 17:11:45 +0200 akim
+++ tests/testsuite.at Fri, 24 Aug 2001 18:06:42 +0200 akim
@@ -21,23 +21,26 @@
 # We need a recent Autotest.
 m4_version_prereq([2.52c])

-# AT_CHECK_M4(FLAGS, [EXIT-STATUS = 0], STDOUT, STDERR)
+# AT_CHECK_M4(FLAGS, [EXIT-STATUS], [STDOUT], [STDERR])
 # -----------------------------------------------------
 # Hide the impact of libtool on program_invocation_name, and hide
 # the differences of paths when src != build.
 m4_define([AT_CHECK_M4],
-[AT_CHECK([M4PATH=$top_srcdir $M4 -M $top_builddir/modules -d $1],
-          [m4_default([$2], [0])],
-          [$3], [stderr])
-AT_CHECK([[sed -e 's,^[^:]*[lt-]*m4[.ex]*:,m4:,' \
-               -e 's,m4: ../../,m4: ../,'        stderr >&2]], 0, [], [$4])
+[AT_CHECK([M4PATH=$top_srcdir m4 -M $top_builddir/modules -d $1],
+          [$2], [$3], [$4])
 ])


 # We use `dnl' in zillions of places...
 m4_pattern_allow([^dnl$])

-AT_INIT([$M4])
+
+
+## ----------- ##
+## The suite.  ##
+## ----------- ##
+
+AT_INIT([m4])

 # Hand crafted tests.
 m4_include([others.at])
Index: tests/m4
--- tests/m4 Fri, 24 Aug 2001 19:10:22 +0200 akim
+++ tests/m4 Fri, 24 Aug 2001 18:08:48 +0200 akim
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+# Wrapper around a non installed m4 to make it work as an installed one.
+
+. ./atconfig
+test -f atlocal && . ./atlocal
+
+${SHELL} $top_builddir/libtool --mode=execute \
+         $top_builddir/src/m4 ${1+"$@"} 2>/tmp/m4-$$
+status=$?
+
+# Normalize stderr.
+sed 's,^[^:]*[lt-]*m4[.ex]*:,m4:,;s,m4: ../../,m4: ../,' /tmp/m4-$$ >&2
+rm /tmp/m4-$$
+
+exit $status



reply via email to

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