Sorry to answer to myself, but I think I've found a better, simpler
and more appropriate way to speed up the depcomp+libtool tests.  See
attached patch.

OK for master?

Thanks, and sorry for the confusion,
  Stefano
>From e91e8c79dc7a120e1ccb26e4a8cc50a0849d84f3 Mon Sep 17 00:00:00 2001
Message-Id: <e91e8c79dc7a120e1ccb26e4a8cc50a0849d84f3.1328783730.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Thu, 9 Feb 2012 10:41:41 +0100
Subject: [PATCH] depcomp tests: speed up libtool-based tests

When running libtool-oriented tests, our 'depcomp.sh' script used
to run the same checks thrice: once after having run configure
with the '--disable-shared' option, once after having run it with
the '--enable-shared' option, and once by allowing configure to
automatically select which kind of library (or libraries) to build.

This was done to offer extra coverage for some less-common systems,
where libtool might decide, for one reason or another, to disable
static or shared libraries *by default*, even of it was actually
possible to build both those kinds of libraries (see commit
'Release-1-10-24-ge89ec38' of 28-03-2007, "* lib/depcomp (aix):
Rewrite depmode in the spirit of the tru64 one").

But this coverage came at the price of slowing down considerably the
depcomp libtool-oriented tests, since for each of them the tested
source tree was configured and built *twelve* times (rather than
"just" four as it is for the non-libtool case), and we all now how
slow the configuration process for a libtool-using package can be.

Luckily, it turns out we can avoid all these extra configure runs
without reducing coverage, by calling both the 'AC_ENABLE_SHARED'
and 'AC_ENABLE_STATIC' macros in configure.in.  With this, the
execution time of the affected tests is reduced by 60-70%!

* tests/depcomp.sh: Adjust and simplify accordingly.
---
 tests/depcomp.sh |   30 +++++++++---------------------
 1 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/tests/depcomp.sh b/tests/depcomp.sh
index 67db770..fb9d527 100755
--- a/tests/depcomp.sh
+++ b/tests/depcomp.sh
@@ -70,6 +70,8 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
+plan_ 28
+
 ocwd=`pwd` || fatal_ "cannot get current working directory"
 longpath=this-is/a-path/which-has/quite-a/definitely/truly/long_long_name
 cachevar=am_cv_CC_dependencies_compiler_type
@@ -137,6 +139,10 @@ AM_PROG_CC_C_O
 AM_PROG_AR
 `if test $depcomp_with_libtool = yes; then
   echo AC_PROG_LIBTOOL
+  # Try to enable both static and shared libraries by default
+  # whenever possible, to increse coverage.
+  echo AC_ENABLE_STATIC
+  echo AC_ENABLE_SHARED
 else
   echo AC_PROG_RANLIB
 fi`
@@ -148,7 +154,6 @@ mkdir build-aux sub src src/sub2
 
 case $depcomp_with_libtool in
   yes)
-    plan_ 84
     po=Plo objext=lo a=la
     normalized_target=libfoo_la
     LIBPRIMARY=LTLIBRARIES LINKADD=LIBADD
@@ -166,7 +171,6 @@ case $depcomp_with_libtool in
     }
     ;;
   no)
-    plan_ 28
     po=Po objext='$(OBJEXT)' a=a
     normalized_target=foo
     LIBPRIMARY=LIBRARIES LINKADD=LDADD
@@ -276,22 +280,16 @@ case $depmode in
       || fatal_ "configure lacks required cache variable '$cachevar'";;
 esac
 
-cd_top
+for vpath in no simple long absolute; do
 
-do_test ()
-{
   cd_top
+
   if test $vpath = no; then
     pfx="in-tree build"
   else
     pfx="$vpath VPATH"
   fi
-  if test $# -gt 0; then
-    subdir=$1; shift
-    pfx="$pfx, $subdir"
-    test -d $subdir || mkdir $subdir || fatal_ "creating directory $subdir"
-    cd $subdir
-  fi
+
   pfx="[$pfx]"
   case $vpath in
     simple)
@@ -374,17 +372,7 @@ do_test ()
   fi
 
   command_ok_ "$pfx make distclean" check_distclean
-  cd_top
-}
 
-for vpath in no simple long absolute; do
-  if test $depcomp_with_libtool = no; then
-    do_test
-  else
-    do_test default
-    do_test noshared --disable-shared
-    do_test nostatic --disable-static
-  fi
 done
 
 :
-- 
1.7.7.3

Reply via email to