[PATCH] D29030: [LNT] Add cross-compilation support to 'lnt runtest test-suite'

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 11:26:08 PST 2017


MatzeB added a comment.

In https://reviews.llvm.org/D29030#654626, @kristof.beyls wrote:

> In https://reviews.llvm.org/D29030#653494, @MatzeB wrote:
>
> > In https://reviews.llvm.org/D29030#653483, @MatzeB wrote:
> >
> > > What about the existing --cmake-cache flag? We are happily using this for crosscompiling since the early days.
> > >  You can find our toolchain files in test-suite/cmake/caches/target-*.cmake. I haven't used the cmake `XXX_EXTERNAL_TOOLCHAIN` and `XXX_TARGET` flags of cmake yet (as I believe they don't match how xcode toolchains work when crosscompiling) but hopefully they just work in your case.
> > >
> > > Some tips on the cache file you proposed above:
> > >
> > > - You most probably need `set(Variable Value CACHE STRING "")` to have any effects
> > > - I introduced TEST_SUITE_ARCH_FLAGS for cases where you want to add crosscompilation related flags to all compiler and linker invocations. Having this in a separate variable is often useful as you don't compete with people passing in custom C/C++ flags and overriding the flags necessary for the cross compilation.
> >
> >
> > Reading the cmake docu I realize their toolchain files are something different than using cache files. So those two points are probably not relevant to you.
>
>
> I haven't read/understood the --cmake-cache functionality yet; will look into that first.


cmake caches allow you to prepopulate the cache. In practice this allows you to specify a single cache file instead of passing a whole set of -D flags on the cmake commandline (and you can execute cmake code so you can query the environment and change flags based on that). I find a very convenient tool to bake a specific build/test configuration into a single file and share it.
>From reading the cmake docu it sounds like the toolchain files are specifically designed to get crosscompilation in the typical gcc style right (i.e. calling target-triple-tool instead of tool), so this is probably what you want to use as the primary tool for your crosscompilation tasks (though if you need additional options you may still create a cache file that sets the toolchain and the additional options :)

> 
> 
>> As for the rest of the commit: Using a toolchain file looks like just passing a -D flag which is already supported. As for picking up the compiler, couldn't you simply extract that from CMakeCache.txt? And if that doesn't work, shouldn't we rather upstream the changes to CMakeLists.txt that print the compiler instead of having LNT mess around with them?
> 
> I'm trying to eliminate as many not-needed command line options as possible, e.g. --llvm-arch, --cross-compiling, ... . There are already more than enough command line options to lnt runtest, reducing the amount of them probably would make it simpler to use.
>  Indeed, just using a -D flag to enable cross-compiling instead of having a separate lnt runtest command line option for it would be preferable (and then documenting how to use it to do cross-compiling).
>  But then, doesn't the same argument apply to dropping lnt runtest -cflags or lnt runtest -cppflags: they also both could be set using -D?
>  Anyway, let's not go there as part of this patch; I'll first look into whether I can eliminate the need for opts.cc and opts.cxx also for the non-cross-compiling case. In that case, I indeed no longer see the need for a separate option so that lnt is aware we're cross-compiling, and instead we can just use -D.

My argument would be to drop the whole "lnt runtest" mode and let users do the cmake/ninja/lit sequence themselfes and teach "lnt submit" to just submit the results. That way you are never limited by missing or confusing options in lnt runtest, have one layer less to debug and we have one thing less to maintain and keep up to date. Though we may need to write more documentation about the cmake/lit test-suite.


https://reviews.llvm.org/D29030





More information about the llvm-commits mailing list