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" } WDYT? Regards, Stefano