I have been working for extending test coverage for years.
Nowadays, I have several cross-testing (target != host). See http://bb.pgr.jp/console
Each of them (test-*-linux) is doing;
- Assume a preceding builder passes with warming ccache.
- All compilation units will hit ccache whenever the tree is built before lit.
- Almost all compilation units will hit ccache except for Host.cpp when the tree is built with different LLVM_DEFAULT_TARGET_TRIPLE.
FYI, I am doing a trick to let ccache recognize compilation units identical for build.ninja;
$ sed -i -r ‘s=(-I|_COMPILER\S* )/home/bb/\w[^/]*/llvm-project=\1…/llvm-project=g’ build.ninja
In other words, testing builders have almost same build except for Host.cpp.
I have to build the tree for each testing target.
I propose an option to override LLVM_DEFAULT_TARGET_TRIPLE in run-time.
The change will be small but I wonder which option I could take.
Please let me know your suggestions.
- Should it be configurable option?
I think it shouldn’t be required for release binaries, and it wouldn’t be required for most developers.
I think it may be off by default.
- What is the name of environment variable?
I suggest the name itself could be configurable.
If I would introduce the envvar name as “LLVM_TARGET”, clang users would complain why clang didn’t have like “CLANG_TARGET”.
$ cmake -DLLVM_DEFAULT_TARGET_ENVVAR_NAME=LLVM_TARGET
$ LLVM_TARGET=i686-win32 bin/llvm-lit path/to/tests
This feature may be disabled if LLVM_DEFAULT_TARGET_ENVVAR_NAME is blank.
I wonder the name LLVM_DEFAULT_TARGET_ENVVAR_NAME might be weird.
Better suggestions are welcome.
As a future plan, I will implement, in Lit, run tests with the matrix of triples,
like {arm|mips|i686|x86_64}-{darwin|linux|win32}.
Some of tests should be skipped if it isn’t affected to default target triple.
For example, FileCheck
Regards, Takumi