What is the correct way to cross-compile LLVM and run the (in-tree) tests on a target board?

Hi all,

Is there any way to cross-compile LLVM and run check-all, or just the llvm-lit tests, (after moving the build directory) on the target machine?

As far as I can tell from the CMakefiles, there's support only for cross-compiling LLVM and not for running the tests with the resulting compiler.

Thanks,
Vasileios

Ping.

I suppose that this has not been attempted before. Regardless of my use case, I was thinking that it would be a useful feature to have, for quickly testing targets where building Clang/LLVM natively is slow.

- Vasileios

Hi Vasileios,

It is possible, although a bit hacky. Gabor (CC'd) has done a similar
thing for AArch64 when the only thing we had were models.

There was a buildbot on it, maybe you can use the code to guide you through.

cheers,
--renato

Hi all,

Is there any way to cross-compile LLVM and run check-all, or just the
llvm-lit tests, (after moving the build directory) on the target
machine?

You mean on the $host, when $build != $host? The only real $target tests are for the runtimes.

For libcxx and libcxxabi, there's a TargetExecutor thing that can be used to execute tests on a remote target over ssh (or with a script). Compiler-rt has a similar thing, with executor scripts, but I don't know the details.

As far as I can tell from the CMakefiles, there's support only for
cross-compiling LLVM and not for running the tests with the resulting
compiler.

As for running the host tests in the lit suite when $host != $build, I think copying is sufficient. We cross-build from linux build machines to windows+cygwin host machines, and to run the tests we just nfs mount the build dir on the windows machine and fire up the testsuite in the "normal" way, just on the other machine.

Jon

Hi Jon,

We cross-build from linux build machines to
windows+cygwin host machines, and to run the tests we just nfs mount the
build dir on the windows machine and fire up the testsuite in the
"normal" way, just on the other machine.

That's what we are trying to do too. I guess something goes wary at configuration time. I'll give it another try and see if I can get it to work correctly.

There was a buildbot on it, maybe you can use the code to guide you through.

@Renato: Is the buildbot or its configuration still available anywhere (I guess in zorg's history)? I'd like to take a look out of curiosity.

Thanks,
Vasileios

Hi Jon,

We cross-build from linux build machines to
windows+cygwin host machines, and to run the tests we just nfs mount the
build dir on the windows machine and fire up the testsuite in the
"normal" way, just on the other machine.

That's what we are trying to do too. I guess something goes wary at configuration time. I'll give it another try and see if I can get it to work correctly.

One thing that might help is to mount things in the same place as they would be on the other machine so the absolute paths still match up.

Jon

Hi Vasileios,

Yes, it was removed on r259397.

It uses the LLVMBuildFactory:

Check-all:
         'factory':
LLVMBuilder.getLLVMBuildFactory(config_name='Release+Asserts',

extra_configure_args=["--host=aarch64-linux-gnu"])},

Test-suite:
         'factory' : LNTBuilder.getLNTFactory(triple='aarch64-linux-gnu',

nt_flags=['--llvm-arch=AArch64', '-j4'],
                                              jobs=4,
use_pty_in_tests=True, clean=False,

testerName='LNT-TestOnly-AArch64', run_cxx_tests=True)},

cheers,
--renato