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

Kristof Beyls via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 02:47:28 PST 2017


kristof.beyls marked 3 inline comments as done.
kristof.beyls added a comment.

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.

> 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.



================
Comment at: lnt/tests/test_suite.py:389
+
+        if self.opts.cc is not None and \
+           self.opts.cross_compiling_toolchain_file is not None:
----------------
MatzeB wrote:
> kristof.beyls wrote:
> > rengolin wrote:
> > > So the tools like fpcmp will be compiled to the target and executed on the QEMU as well?
> > No, the test-suite's cmake infrastructure already handles this well: tools like fpcmp are built and run natively on the host.
> qemu can probably be used with the --run-under flag.
Indeed, that's what I'm doing in the example 'lnt runtest test-suite' invocation command I gave above.


https://reviews.llvm.org/D29030





More information about the llvm-commits mailing list