[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [FYI] {maint} testsuite: be more cross-compile friendly
From: |
Stefano Lattarini |
Subject: |
Re: [FYI] {maint} testsuite: be more cross-compile friendly |
Date: |
Sat, 21 May 2011 09:21:01 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
On Sunday 15 May 2011, Stefano Lattarini wrote:
> On Sunday 15 May 2011, Stefano Lattarini wrote:
> > On Sunday 15 May 2011, Ralf Wildenhues wrote:
> > > * Stefano Lattarini wrote on Sun, May 15, 2011 at 03:48:43PM CEST:
> > > > I've applied the attached patch to 'maint', rather than to
> > > > 'testsuite-work',
> > > > only to make it easier to (potentially) backport tests for future
> > > > bugfixing.
> > > > I plan to check in fixes tests that don't currently work in
> > > > cross-compile
> > > > mode only in the 'testsuite-work' branch, to avoid excessive churn on
> > > > 'maint' and 'master'.
> > >
> > > > Subject: [PATCH] testsuite: be more cross-compile friendly
> > > >
> > > > * tests/defs.in (cross_compiling): New subroutine.
> > > > (am__tool_prefix): New internal variable.
> > > > (gcc, g++, gcj): Force the use of the correct "tool prefix"
> > > > when cross compiling.
> > > > (gfortran, g77, non-cross): New requirements.
> > >
> > > > --- a/tests/defs.in
> > > > +++ b/tests/defs.in
> > > > @@ -148,6 +148,23 @@ fail_ () { warn_ "$me: failed test: $@"; Exit 1; }
> > > > skip_ () { warn_ "$me: skipped test: $@"; Exit 77; }
> > > > framework_failure_ () { warn_ "$me: set-up failure: $@"; Exit 99; }
> > > >
> > > > +# cross_compiling
> > > > +# ---------------
> > > > +# Tell whether we are cross-compiling. This is especially useful to
> > > > skip
> > > > +# tests (or portions of them) that requires a native compiler.
> > > > +cross_compiling ()
> > > > +{
> > > > + test x"$host_alias" != x
> > > > +}
> > >
> > > FWIW, this condition isn't the same as the one configure uses in order
> > > to determine whether cross compilation is enabled or not. Is that an
> > > oversight or on purpose?
> > >
> > Oversight, sorry (it's basically the first time I'm doing cross-compilation,
> > if that's any excuse). What condition should I use instead?
> >
> OK, we could use the `$cross_compiling' variable inside configure.ac, but
> obviously not inside `tests/defs'.
>
> My idea is that a simple:
> $ make check host_alias='...'
> should suffice to run the testsuite in cross-compile mode -- and this is
> what I'm succesfully doing right now.
>
> But maybe it should be safer and more correct to follow the configure logic
> more closely when determining whether cross-compilation is in effect; i.e.,
> our definition of `cross_compiling' should become something like:
>
> host_alias=${host_alias-'@host_alias@'}
> build_alias=${build_alias-'@build_alias@'}
> cross_compiling ()
> {
> test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
> }
>
I've now implemented this idea in the 'testsuite-work' branch; attached
is what I've pushed.
Regards,
Stefano
From f570885382e0a37fc8f2c7fd2e63b5321e0b5612 Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
From: Stefano Lattarini <address@hidden>
Date: Sat, 21 May 2011 09:12:06 +0200
Subject: [PATCH] test defs: better detection of cross-compile mode
* configure.ac (AC_CANONICAL_HOST): New, probably not strictly
necessary, but useful to complements AC_CANONICAL_BUILD.
* tests/defs-static.in ($host_alias, $build_alias): New variables,
exported, user-overridable, defaults AC_SUBST'd by configure.
* tests/defs (cross_compiling): Consider cross-compilation mode
active only if `$host_alias' is not empty *and* it differs from
`$build_alias'. This is more faithful to the way configure
determines whether it is cross-compiling, but still allows the
user to easily force cross-compilation by overriding `host_alias'
and `build_alias' at runtime.
From a report by Ralf Wildenhues.
---
ChangeLog | 15 +++++++++++++++
Makefile.in | 5 +++++
configure | 39 +++++++++++++++++++++++++++++++++++++++
configure.ac | 4 +++-
doc/Makefile.in | 5 +++++
lib/Automake/Makefile.in | 5 +++++
lib/Automake/tests/Makefile.in | 5 +++++
lib/Makefile.in | 5 +++++
lib/am/Makefile.in | 5 +++++
m4/Makefile.in | 5 +++++
tests/Makefile.in | 5 +++++
tests/defs | 2 +-
tests/defs-static.in | 3 +++
13 files changed, 101 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3f93d41..fd23cb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2011-05-21 Stefano Lattarini <address@hidden>
+
+ test defs: better detection of cross-compile mode
+ * configure.ac (AC_CANONICAL_HOST): New, probably not strictly
+ necessary, but useful to complements AC_CANONICAL_BUILD.
+ * tests/defs-static.in ($host_alias, $build_alias): New variables,
+ exported, user-overridable, defaults AC_SUBST'd by configure.
+ * tests/defs (cross_compiling): Consider cross-compilation mode
+ active only if `$host_alias' is not empty *and* it differs from
+ `$build_alias'. This is more faithful to the way configure
+ determines whether it is cross-compiling, but still allows the
+ user to easily force cross-compilation by overriding `host_alias'
+ and `build_alias' at runtime.
+ From a report by Ralf Wildenhues.
+
2011-05-20 Stefano Lattarini <address@hidden>
testsuite: avoid re-running few tests with 'parallel-tests' option
diff --git a/Makefile.in b/Makefile.in
index 6494ca0..9514291 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -49,6 +49,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
+host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
@@ -219,7 +220,11 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+host = @host@
host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
diff --git a/configure b/configure
index e2add32..084d8d2 100755
--- a/configure
+++ b/configure
@@ -607,6 +607,10 @@ INSTALL_SCRIPT
INSTALL_PROGRAM
am_AUTOHEADER
am_AUTOCONF
+host_os
+host_vendor
+host_cpu
+host
build_os
build_vendor
build_cpu
@@ -1263,6 +1267,7 @@ Program names:
System types:
--build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi
@@ -1781,6 +1786,40 @@ IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed"
"$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
# Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this
# way we can run Autoconf tests from configure (or from the test
diff --git a/configure.ac b/configure.ac
index 577541c..857177b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,8 @@
# Process this file with autoconf to produce a configure script.
# Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# 2004, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,6 +25,7 @@ m4_ifndef([AC_PACKAGE_URL],
AC_CONFIG_SRCDIR(automake.in)
AC_CONFIG_AUX_DIR(lib)
+AC_CANONICAL_HOST
AC_CANONICAL_BUILD
# Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 7bc40a6..193c9fe 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -48,6 +48,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
+host_triplet = @host@
subdir = doc
DIST_COMMON = $(automake_TEXINFOS) $(dist_doc_DATA) $(dist_man1_MANS) \
$(dist_noinst_DATA) $(srcdir)/Makefile.am \
@@ -204,7 +205,11 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+host = @host@
host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in
index 20b1957..93cbf39 100644
--- a/lib/Automake/Makefile.in
+++ b/lib/Automake/Makefile.in
@@ -49,6 +49,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
+host_triplet = @host@
subdir = lib/Automake
DIST_COMMON = $(dist_perllib_DATA) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
@@ -203,7 +204,11 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+host = @host@
host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index d82bd74..8ade033 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -48,6 +48,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
+host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/CheckListOfTests.am
subdir = lib/Automake/tests
@@ -253,7 +254,11 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+host = @host@
host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 9195976..1f6e5e5 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -49,6 +49,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
+host_triplet = @host@
subdir = lib
DIST_COMMON = $(dist_pkgvdata_DATA) $(dist_script_DATA) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING INSTALL \
@@ -206,7 +207,11 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+host = @host@
host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in
index 059ae97..e4b0ec2 100644
--- a/lib/am/Makefile.in
+++ b/lib/am/Makefile.in
@@ -49,6 +49,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
+host_triplet = @host@
subdir = lib/am
DIST_COMMON = $(dist_am_DATA) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
@@ -163,7 +164,11 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+host = @host@
host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
diff --git a/m4/Makefile.in b/m4/Makefile.in
index e508848..b876b3d 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -49,6 +49,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
+host_triplet = @host@
subdir = m4
DIST_COMMON = $(dist_m4data_DATA) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
@@ -163,7 +164,11 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+host = @host@
host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 87dd626..711f4ca 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -48,6 +48,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
+host_triplet = @host@
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs \
$(srcdir)/defs-static.in $(srcdir)/depmod-tests.am \
@@ -264,7 +265,11 @@ datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+host = @host@
host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
diff --git a/tests/defs b/tests/defs
index e17df6c..b254ef4 100644
--- a/tests/defs
+++ b/tests/defs
@@ -135,7 +135,7 @@ framework_failure_ () { warn_ "$me: set-up failure: $@";
Exit 99; }
# tests (or portions of them) that requires a native compiler.
cross_compiling ()
{
- test x"$host_alias" != x
+ test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
}
# is_newest FILE FILES
diff --git a/tests/defs-static.in b/tests/defs-static.in
index 45f08bf..df5072f 100644
--- a/tests/defs-static.in
+++ b/tests/defs-static.in
@@ -83,6 +83,9 @@ testprefix='@prefix@'
APIVERSION='@APIVERSION@'
PATH_SEPARATOR='@PATH_SEPARATOR@'
+host_alias=${host_alias-'@host_alias@'}; export host_alias
+build_alias=${build_alias-'@build_alias@'}; export build_alias
+
# Make sure we override the user shell.
SHELL='@SHELL@'; export SHELL
# User can override various tools used.
--
1.7.2.3