autoconf-patches
[Top][All Lists]
Advanced

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

36-test-srcdir.patch


From: Akim Demaille
Subject: 36-test-srcdir.patch
Date: Mon, 20 Aug 2001 16:48:12 +0200

There remains work to perform on the various computations of
top_srcdir and so on: as is today, it is not canonicalized and you can
have exotic stuff such as srcdir=.././tests instead of a plain `.'.

I'm not sure how to clean this up.

But I'm sure it's high time to find some factorization wrt this in
Autoconf: this code can be seen at least at four different places :(
With subtle differences I don't understand too well yet.  If some
brave soul is ready to pick up the challenge, she is most welcome.
Guys can try it too.

I'm tired, but happy.  I really think Autotest is becoming neat.

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

        * lib/autotest/general.m4 (AT_INIT): Compute top_builddir,
        top_srcdir and srcdir from at_topbuild_2_topsrc and at_testdir.
        Load atlocal late enough to dump it in the log.
        * m4/atconfig.m4 (AT_CONFIG): Pass them to atconfig.

Index: configure.ac
--- configure.ac Sun, 19 Aug 2001 13:08:48 +0200 akim
+++ configure.ac Sun, 19 Aug 2001 21:52:29 +0200 akim
@@ -26,7 +26,7 @@
 AM_INIT_AUTOMAKE(autoconf, 2.52c)

 # Initialize the test suite.
-AT_CONFIG(tests, ../bin)
+AT_CONFIG(tests, bin)
 AC_PATH_PROG(EXPR, expr)

 # We use a path for GNU m4 so even if users have another m4 first in
Index: lib/autotest/general.m4
--- lib/autotest/general.m4 Sun, 19 Aug 2001 12:28:04 +0200 akim
+++ lib/autotest/general.m4 Sun, 19 Aug 2001 22:19:15 +0200 akim
@@ -94,6 +94,15 @@ m4_define([AT_data_files], [stdout expou
 SHELL=${CONFIG_SHELL-/bin/sh}

 . ./atconfig
+
+# Path to the top builddir: reverse at_testdir
+top_builddir=`echo '$at_testdir' |
+                sed 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,/$,,'`
+# Path to the top srcdir: to go to top build, then to top src
+top_srcdir=$top_builddir/$at_topbuild_2_topsrc
+# Path to srcdir: from top srcdir to this dir.
+srcdir=$top_srcdir/$at_testdir
+
 # Use absolute file notations, as the test might change directories.
 at_srcdir=`cd "$srcdir" && pwd`
 at_top_srcdir=`cd "$top_srcdir" && pwd`
@@ -112,8 +121,6 @@ m4_define([AT_data_files], [stdout expou
 PATH=$at_path
 export PATH

-test -f atlocal && . ./atlocal
-
 # -e sets to true
 at_stop_on_error=false
 # Shall we be verbose?
@@ -197,14 +204,6 @@ Tests:
   at_diff=diff
 fi

-# Tester and tested.
-if $1 --version | grep "$at_package.*$at_version" >/dev/null; then
-  AS_BOX([Test suite for $at_package $at_version])
-else
-  AS_BOX([ERROR: Not using the proper version, no tests performed])
-  exit 1
-fi
-
 # Setting up the FDs.
 # 5 is stdout conditioned by verbosity.
 if test $at_verbose = echo; then
@@ -218,6 +217,14 @@ Tests:
   exec 6>/dev/null
 else
   exec 6>$as_me.log
+fi
+
+# Load the user config file before checking the PATH.
+test -r ./atlocal && . ./atlocal
+
+# Tester and tested.
+if $1 --version | grep "$at_package.*$at_version" >/dev/null; then
+  AS_BOX([Test suite for $at_package $at_version])
   {
     AS_BOX([Test suite log for $at_package $at_version])
     echo
@@ -234,8 +241,27 @@ Tests:
     AS_UNAME
     echo

+   # Inform about the contents of the config files.
+   echo "$as_me: atconfig:" >&6
+   sed 's/^/| /' atconfig >&6
+   if test -r ./atlocal; then
+     echo "$as_me: atlocal:" >&6
+     sed 's/^/| /' atlocal >&6
+   fi
+fi
+
+# Load the configuration files.
+if test -r ./atlocal; then
+  echo "$as_me: loading atlocal" >&6
+  sed 's/^/| /' atlocal >&6
+  . ./atlocal
+fi
+
     AS_BOX([Running silently the tests])
   } >&6
+else
+  AS_BOX([ERROR: Not using the proper version, no tests performed])
+  exit 1
 fi

 at_start_date=`date`
Index: m4/atconfig.m4
--- m4/atconfig.m4 Sun, 19 Aug 2001 18:05:20 +0200 akim
+++ m4/atconfig.m4 Sun, 19 Aug 2001 22:13:50 +0200 akim
@@ -2,7 +2,7 @@
 ## Prepare for testing.  ##
 ## ----------------------##

-#serial 5
+#serial 6

 # Copyright 2000, 2001 Free Software Foundation, Inc.
 #
@@ -21,14 +21,15 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.

+
 # AT_CONFIG(TEST-DIRECTORY, [AUTOTEST-PATH = .])
 # ----------------------------------------------
 # Configure the test suite.
 #
-# AUTOTEST-PATH must help the test suite to find the executables, i.e.,
-# if the test suite is in `tests/' and the executables are in `src/',
-# pass `../src'.  If there are also executables in the source tree, use
-# `../src:$top_srcdir/src'.
+# AUTOTEST-PATH must help the test suite to find the executables,
+# i.e., if the executables are in `src/', pass `src'.  If there are
+# also executables in the source tree, use `src:$top_srcdir/src'.
+
 AC_DEFUN([AT_CONFIG],
 [AC_CONFIG_COMMANDS([$1/atconfig],
 [cat >$1/atconfig <<EOF
@@ -43,8 +44,9 @@ AC_DEFUN([AT_CONFIG],
 at_n='$at_n'
 at_c='$at_c'

-srcdir='$srcdir'
-top_srcdir='$top_srcdir'
+at_testdir='$1'
+at_topbuild_2_topsrc='$at_topbuild_2_topsrc'
+
 AUTOTEST_PATH='m4_default([$2], [.])'

 SHELL=\${CONFIG_SHELL-'$at_shell'}
@@ -59,8 +61,8 @@ AC_DEFUN([AT_CONFIG],
 at_n='$ECHO_N'
 at_c='$ECHO_C'

-srcdir='$srcdir'
-top_srcdir=`echo '$1/' | sed 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,/$,,'`
+# Path from top_build to top_src
+at_topbuild_2_topsrc=$srcdir

 at_shell='$SHELL'
 at_path_separator='$PATH_SEPARATOR'
Index: lib/autotest/general.m4
--- lib/autotest/general.m4 Sun, 19 Aug 2001 22:23:58 +0200 akim
+++ lib/autotest/general.m4 Sun, 19 Aug 2001 22:40:01 +0200 akim
@@ -248,14 +248,6 @@ Tests:
      echo "$as_me: atlocal:" >&6
      sed 's/^/| /' atlocal >&6
    fi
-fi
-
-# Load the configuration files.
-if test -r ./atlocal; then
-  echo "$as_me: loading atlocal" >&6
-  sed 's/^/| /' atlocal >&6
-  . ./atlocal
-fi

     AS_BOX([Running silently the tests])
   } >&6



reply via email to

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