autoconf-patches
[Top][All Lists]
Advanced

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

Autoconf testsuite and cross toolchains: configure_options


From: Ralf Wildenhues
Subject: Autoconf testsuite and cross toolchains: configure_options
Date: Sun, 13 Sep 2009 18:08:56 +0200
User-agent: Mutt/1.5.20 (2009-08-09)

It can be helpful to run the Autoconf testsuite with a cross compiler,
or other weird tools or programs set.  It causes a few spurious failures
but otherwise works fine with the two patches below.  WDYT?

E.g., with below, on my system,
  make check TESTSUITEFLAGS="configure_options='--host=i586-mingw32msvc \
             --build=i686-pc-linux-gnu FC=no F77=no ERL=no ERLC=no'"

a test run only fails these:
 229: compile.at:119     AC_RUN_IFELSE
 230: compile.at:152     Order of user actions and cleanup
 304: semantics.at:417   AC_CHECK_FILES
 310: semantics.at:698   AC_SYS_RESTARTABLE_SYSCALLS
 331: acgeneral.at:33    AC_TRY_RUN
      autoupdate
 420: acfunctions.at:32  AC_FUNC_SETPGRP

(I haven't looked into them at all for a fix which wouldn't weaken the
tests.)

Except for the --host and --build, most interesting settings could also
be done via environment variables, but above records the details better.

I changed the default values for ERL, ERLC to avoid the need for ugly
quoting of "not found".

Cheers,
Ralf

>From 2bc871f1d2e6e737fb7f04205d8813539cc66c7b Mon Sep 17 00:00:00 2001
From: Ralf Wildenhues <address@hidden>
Date: Sun, 13 Sep 2009 13:40:06 +0200
Subject: [PATCH 1/2] testsuite: improve Erlang tests portability, 
overridability.

* tests/autotest.at (Erlang Eunit unit tests): Use "no" as
value-if-not-found for Erlang tools.
* tests/erlang.at: Likewise.  Also, use AS_EXIT instead of plain
exit.
---
 tests/autotest.at |    6 +++---
 tests/erlang.at   |   32 ++++++++++++++++----------------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/tests/autotest.at b/tests/autotest.at
index 05e7cce..8b0a6c2 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -1438,9 +1438,9 @@ AT_KEYWORDS([Erlang])
 
 mkdir s t
 AT_DATA([configure.ac], [[AC_INIT
-AC_ERLANG_PATH_ERL([not found])
-AC_ERLANG_PATH_ERLC([not found])
-if test "$ERL" = "not found" || test "$ERLC" = "not found"; then
+AC_ERLANG_PATH_ERL([no])
+AC_ERLANG_PATH_ERLC([no])
+if test "$ERL" = "no" || test "$ERLC" = "no"; then
   HAVE_ERLANG=no
   HAVE_EUNIT=no
 else
diff --git a/tests/erlang.at b/tests/erlang.at
index 7865b14..1cd43f9 100644
--- a/tests/erlang.at
+++ b/tests/erlang.at
@@ -30,9 +30,9 @@ AT_BANNER([Erlang low level compiling and utility macros.])
 ## ----------------- ##
 
 AT_CHECK_MACRO([Erlang],
-[[AC_ERLANG_PATH_ERL([not found])
-AC_ERLANG_PATH_ERLC([not found])
-if test "$ERL" = "not found" || test "$ERLC" = "not found"; then exit 77; fi
+[[AC_ERLANG_PATH_ERL([no])
+AC_ERLANG_PATH_ERLC([no])
+if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
 AC_LANG([Erlang])
 ## Can't compile, but can run an Erlang module:
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
@@ -52,14 +52,14 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
 ## ---------------------- ##
 
 AT_CHECK_MACRO([AC_ERLANG_CHECK_LIB],
-[[AC_ERLANG_PATH_ERL([not found])
-AC_ERLANG_PATH_ERLC([not found])
-if test "$ERL" = "not found" || test "$ERLC" = "not found"; then exit 77; fi
+[[AC_ERLANG_PATH_ERL([no])
+AC_ERLANG_PATH_ERLC([no])
+if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
 AC_ERLANG_CHECK_LIB([stdlib],
                    [AC_MSG_RESULT([ok])],
                    [AC_MSG_RESULT([failed])])
 ## Test that the lib path detection really detected a directory:
-if test "$ERLANG_LIB_DIR_stdlib" != "not found" \
+if test "$ERLANG_LIB_DIR_stdlib" != "no" \
   && test ! -d "$ERLANG_LIB_DIR_stdlib"; then
        AC_MSG_ERROR([incorrect ERLANG_LIB_DIR_stdlib variable])
 fi
@@ -72,9 +72,9 @@ fi
 ## --------------------------- ##
 
 AT_CHECK_MACRO([AC_ERLANG_SUBST_ROOT_DIR],
-[[AC_ERLANG_PATH_ERL([not found])
-AC_ERLANG_PATH_ERLC([not found])
-if test "$ERL" = "not found" || test "$ERLC" = "not found"; then exit 77; fi
+[[AC_ERLANG_PATH_ERL([no])
+AC_ERLANG_PATH_ERLC([no])
+if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
 AC_ERLANG_SUBST_ROOT_DIR
 ## Test that the root path detection really detected a directory:
 if test ! -d "$ERLANG_ROOT_DIR"; then
@@ -89,9 +89,9 @@ fi
 ## -------------------------- ##
 
 AT_CHECK_MACRO([AC_ERLANG_SUBST_LIB_DIR],
-[[AC_ERLANG_PATH_ERL([not found])
-AC_ERLANG_PATH_ERLC([not found])
-if test "$ERL" = "not found" || test "$ERLC" = "not found"; then exit 77; fi
+[[AC_ERLANG_PATH_ERL([no])
+AC_ERLANG_PATH_ERLC([no])
+if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
 AC_ERLANG_SUBST_LIB_DIR
 ## Test that the lib path detection really detected a directory:
 if test ! -d "$ERLANG_LIB_DIR"; then
@@ -128,9 +128,9 @@ fi
 ## -------------------------- ##
 
 AT_CHECK_MACRO([AC_ERLANG_SUBST_ERTS_VER],
-[[AC_ERLANG_PATH_ERL([not found])
-AC_ERLANG_PATH_ERLC([not found])
-if test "$ERL" = "not found" || test "$ERLC" = "not found"; then exit 77; fi
+[[AC_ERLANG_PATH_ERL([no])
+AC_ERLANG_PATH_ERLC([no])
+if test "$ERL" = "no" || test "$ERLC" = "no"; then AS_EXIT([77]); fi
 AC_ERLANG_SUBST_ERTS_VER
 ]],
 [AT_KEYWORDS([Erlang])])
-- 
1.6.3.3.345.gb7132


>From 2c698d4a9d86084e3b26c53df0e62ef7cead51e2 Mon Sep 17 00:00:00 2001
From: Ralf Wildenhues <address@hidden>
Date: Sun, 13 Sep 2009 18:03:31 +0200
Subject: [PATCH 2/2] testsuite: pass $configure_options to configure 
invocations.

* tests/local.at (AT_CHECK_CONFIGURE): Add $configure_options
to configure command line.
* tests/autotest.at, tests/base.at, tests/c.at, tests/torture.at:
Likewise for each configure invocation.
* README-hacking: Document configure_options.
---
 README-hacking    |    5 ++++
 tests/autotest.at |    8 +++---
 tests/base.at     |    4 +-
 tests/c.at        |    2 +-
 tests/local.at    |    2 +-
 tests/torture.at  |   60 ++++++++++++++++++++++++++++------------------------
 6 files changed, 45 insertions(+), 36 deletions(-)

diff --git a/README-hacking b/README-hacking
index fc96a86..e985f0b 100644
--- a/README-hacking
+++ b/README-hacking
@@ -96,6 +96,11 @@ keyword as well as test 10:
 
   $ make check TESTSUITEFLAGS='10 -k m4sugar'
 
+You can pass options to configure scripts invoked by the testsuite by
+setting the configure_options variable:
+
+  $ make check TESTSUITEFLAGS='configure_options="CC=gcc-2.95"'
+
 * Submitting patches
 
 All patches should be submitted to <address@hidden> for
diff --git a/tests/autotest.at b/tests/autotest.at
index 8b0a6c2..b95d9ee 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -1339,7 +1339,7 @@ AT_CLEANUP
 
 # Build directory totally outside source directory.
 cd vpath-outside
-AT_CHECK([../pkg/configure], [0], [ignore])
+AT_CHECK([../pkg/configure $configure_options], [0], [ignore])
 cd t
 AT_CHECK([../../pkg/t/suite], [0], [ignore])
 cd ../..
@@ -1347,20 +1347,20 @@ cd ../..
 # Build directory totally outside source directory (absolute).
 my_srcdir=`pwd`/pkg
 cd vpath-abs
-AT_CHECK(["$my_srcdir"/configure], [0], [ignore])
+AT_CHECK(["$my_srcdir"/configure $configure_options], [0], [ignore])
 cd t
 AT_CHECK(["$my_srcdir"/t/suite], [0], [ignore])
 cd ../..
 
 # Build directory as subdirectory of source directory.
 cd pkg/vpath-inside
-AT_CHECK([../configure], [0], [ignore])
+AT_CHECK([../configure $configure_options], [0], [ignore])
 cd t
 AT_CHECK([../../t/suite], [0], [ignore])
 cd ../../..
 
 # Build directory as parent of source directory.
-AT_CHECK([pkg/configure], [0], [ignore])
+AT_CHECK([pkg/configure $configure_options], [0], [ignore])
 cd t
 AT_CHECK([../pkg/t/suite], [0], [ignore])
 cd ..
diff --git a/tests/base.at b/tests/base.at
index 21a2c82..5929927 100644
--- a/tests/base.at
+++ b/tests/base.at
@@ -297,9 +297,9 @@ AT_DATA([configure.ac],
 cat <&AS@&address@hidden >&AS@&address@hidden
 ]])
 AT_CHECK_AUTOCONF
-AT_CHECK([echo Hello | CONFIG_SITE=/dev/null ./configure | grep -v 'configure: 
loading site script '],, [Hello
+AT_CHECK([echo Hello | CONFIG_SITE=/dev/null ./configure $configure_options | 
grep -v 'configure: loading site script '],, [Hello
 ])
-AT_CHECK([echo Hello | CONFIG_SITE=/dev/null ./configure --silent])
+AT_CHECK([echo Hello | CONFIG_SITE=/dev/null ./configure $configure_options 
--silent])
 
 AT_CLEANUP
 
diff --git a/tests/c.at b/tests/c.at
index 668b676..8235be2 100644
--- a/tests/c.at
+++ b/tests/c.at
@@ -315,7 +315,7 @@ class foo foobar;
 
 AT_CHECK([autoconf])
 AT_CHECK([autoheader])
-AT_CHECK([./configure], [], [ignore], [ignore])
+AT_CHECK([./configure $configure_options], [], [ignore], [ignore])
 AT_CHECK([${MAKE-make} cpp-works || exit 77], [], [ignore], [ignore])
 AT_CHECK([${MAKE-make}], [], [ignore], [ignore])
 
diff --git a/tests/local.at b/tests/local.at
index acc4669..dc9e0ef 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -229,7 +229,7 @@ m4_define([AT_CHECK_AUTOHEADER],
 # Using --srcdir is more expensive.
 m4_define([AT_CHECK_CONFIGURE],
 [AT_CAPTURE_FILE([config.log])[]dnl
- AT_CHECK([./configure $1],
+ AT_CHECK([./configure $configure_options $1],
          [$2],
          m4_default([$3], [ignore]), [$4])])
 
diff --git a/tests/torture.at b/tests/torture.at
index fe4c131..b2fc7c3 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -426,7 +426,7 @@ AT_CHECK_CONFIGURE([one=one --enable-two=two 
--with-three=three |
 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
         [onetwothree
 ])
-AT_CHECK([args=`./config.status --config` && eval ./configure "$args" |
+AT_CHECK([args=`./config.status --config` && eval ./configure 
\$configure_options "$args" |
            sed -n -e 's/^result=//p'], 0,
         [m4_do([onetwothree
 ],             [onetwothree
@@ -441,7 +441,7 @@ AT_CHECK([./config.status --recheck | sed -n 
's/^result=//p'], 0,
         ["'$ " '  $    "'$
 ])
 dnl restore font-lock: "
-AT_CHECK([args=`./config.status --config` && eval ./configure "$args" |
+AT_CHECK([args=`./config.status --config` && eval ./configure 
\$configure_options "$args" |
            sed -n -e 's/^result=//p'], 0,
         [m4_do(["'$ " '  $     "'$
 ],             ["'$ " '  $     "'$
@@ -1094,14 +1094,14 @@ rm -f -r foo at-dir/bar
 AT_CHECK_AUTOCONF
 
 # In place.
-AT_CHECK([./configure], [], [ignore])
+AT_CHECK([./configure $configure_options], [], [ignore])
 
 # Relative name.
-AT_CHECK([cd at-dir && ../configure], [], [ignore])
+AT_CHECK([cd at-dir && ../configure $configure_options], [], [ignore])
 
 # Absolute name.
 at_here=`pwd`
-AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore])
+AT_CHECK([cd at-dir && "$at_here/configure" $configure_options], [], [ignore])
 
 AT_CLEANUP
 
@@ -1141,17 +1141,20 @@ echo file1 > src/s
 echo file2 > src/t
 AT_CHECK_AUTOCONF
 cd build
-AT_CHECK([../configure && ../configure], 0, [ignore])
+AT_CHECK([../configure $configure_options && ../configure $configure_options],
+        0, [ignore])
 AT_CHECK([cat src/s src/t], 0, [file1
 file2
 ])
 cd ..
-AT_CHECK([./configure && ./configure], 0, [ignore], [stderr])
+AT_CHECK([./configure $configure_options && ./configure $configure_options],
+        0, [ignore], [stderr])
 AT_CHECK([grep src/t stderr], 1)
 AT_CHECK([cat src/s src/t], 0, [file1
 file2
 ])
-AT_CHECK(["`pwd`"/configure && "`pwd`"/configure], 0, [ignore], [ignore])
+AT_CHECK(["`pwd`"/configure $configure_options && "`pwd`"/configure 
$configure_options],
+        0, [ignore], [ignore])
 AT_CHECK([cat src/s src/t], 0, [file1
 file2
 ])
@@ -1243,7 +1246,7 @@ AT_CHECK([test -f inner/configure])
 # Running the outer configure recursively should provide the innermost
 # help strings.
 chmod a-w inner/innermost inner .
-AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep INNER], 0,
+AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | 
grep INNER], 0,
         [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod u+w . inner inner/innermost
@@ -1259,7 +1262,7 @@ prefix=/usr/local
 
 # The same, but from a builddir.
 AS_MKDIR_P([builddir])
-AT_CHECK([cd builddir && ../configure], 0, [ignore])
+AT_CHECK([cd builddir && ../configure $configure_options], 0, [ignore])
 AT_CHECK([cat builddir/inner/innermost/config], 0,
 [INNER=inner
 srcdir=../../../inner/innermost
@@ -1269,7 +1272,8 @@ prefix=/usr/local
 
 # Make sure precious variables and command line options are properly
 # passed, even when there are duplicates.
-AT_CHECK([cd builddir && ../configure --prefix /bad --prefix /good INNER=bad 
INNER=good], 0, [ignore])
+AT_CHECK([cd builddir && ../configure $configure_options --prefix /bad 
--prefix /good INNER=bad INNER=good],
+        0, [ignore])
 AT_CHECK([cat builddir/inner/innermost/config], 0,
 [INNER=good
 srcdir=../../../inner/innermost
@@ -1287,7 +1291,7 @@ prefix=/a  b c$ 'd
 ])
 
 # Make sure --silent is properly passed...
-AT_CHECK([cd builddir && ../configure --silent], 0, [])
+AT_CHECK([cd builddir && ../configure $configure_options --silent], 0, [])
 # ...but not stored in config.status.
 AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout])
 AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore])
@@ -1360,27 +1364,27 @@ AT_CHECK([test -f inner2/configure])
 # Running the outer configure recursively should provide the innermost
 # help strings.
 chmod a-w inner/innermost inner
-AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNER "],
+AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | 
grep " INNER "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod a-w .
-AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNER2 "],
+AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | 
grep " INNER2 "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod a-w .
-AT_CHECK([{ ./configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
+AT_CHECK([{ ./configure $configure_options --help=recursive; chmod u+w .; } | 
grep " INNERMOST "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod a-w .
-AT_CHECK([{ /bin/sh ./configure --help=recursive; chmod u+w .; } | grep " 
INNERMOST "],
+AT_CHECK([{ /bin/sh ./configure $configure_options --help=recursive; chmod u+w 
.; } | grep " INNERMOST "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod a-w .
-AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { /bin/sh configure 
--help=recursive; chmod +w .; } | grep " INNERMOST "],
+AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { /bin/sh configure 
$configure_options --help=recursive; chmod +w .; } | grep " INNERMOST "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod a-w .
-AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { configure 
--help=recursive; chmod u+w .; } | grep " INNERMOST "],
+AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; { configure 
$configure_options --help=recursive; chmod u+w .; } | grep " INNERMOST "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod u+w inner inner/innermost
@@ -1402,31 +1406,31 @@ cd ..
 # The same, but from a builddir.
 AS_MKDIR_P([builddir])
 chmod a-w builddir inner/innermost inner
-AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | 
grep " INNER "],
+AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; 
chmod u+w .; } | grep " INNER "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod a-w builddir
-AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | 
grep " INNER2 "],
+AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; 
chmod u+w .; } | grep " INNER2 "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod a-w builddir
-AT_CHECK([cd builddir && { ../configure --help=recursive; chmod u+w .; } | 
grep " INNERMOST "],
+AT_CHECK([cd builddir && { ../configure $configure_options --help=recursive; 
chmod u+w .; } | grep " INNERMOST "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod a-w builddir
-AT_CHECK([cd builddir && { /bin/sh ../configure --help=recursive; chmod u+w .; 
} | grep " INNERMOST "],
+AT_CHECK([cd builddir && { /bin/sh ../configure $configure_options 
--help=recursive; chmod u+w .; } | grep " INNERMOST "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod a-w builddir
 # Not all shells search $PATH for scripts.
-if (cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help) 
>/dev/null 2>&1; then
-  AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure 
--help=recursive | grep " INNERMOST "], 0, [ignore])
+if (cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure 
$configure_options --help) >/dev/null 2>&1; then
+  AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure 
$configure_options --help=recursive | grep " INNERMOST "], 0, [ignore])
 fi
-AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir && { 
configure --help=recursive; chmod u+w .; } | grep " INNERMOST "],
+AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir && { 
configure $configure_options --help=recursive; chmod u+w .; } | grep " 
INNERMOST "],
         0, [ignore], [stderr],
         [AT_CHECK([grep 'rerun with a POSIX shell' stderr], [], [ignore])])
 chmod u+w builddir inner inner/innermost
-AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
+AT_CHECK([cd builddir && ../configure $configure_options 
INNERMOST=build/tsomrenni], 0, [ignore])
 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
 [[#define INNERMOST build/tsomrenni
 ]])
@@ -1468,10 +1472,10 @@ AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
 
 # Running the outer configure recursively should provide the innermost
 # help strings.
-AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore])
+AT_CHECK([./configure $configure_options --help=recursive | grep "folks"], 0, 
[ignore])
 
 # Running the outer configure should trigger the inner.
-AT_CHECK([./configure], 0, [ignore])
+AT_CHECK([./configure $configure_options], 0, [ignore])
 AT_CHECK([test -f inner/myfile], 0)
 
 AT_CLEANUP
-- 
1.6.3.3.345.gb7132





reply via email to

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