https://llvm.org/docs/TestSuiteGuide.html
LLVM test-suite leverages the LIT infrastructure for testing. It's a run-time test suite but sometimes we do
not have a real machine for the test. So, I'd like to introduce a mechanism to run it on a simulator by this
patch.
According to the documentations:
Intel SDE:
https://www.intel.com/content/www/us/en/developer/articles/tool/software-development-emulator.html
QEMU:
https://www.qemu.org/docs/master/user/main.html
Here are some usage examples:
llvm-lit ./llvm/test/MC/X86/abs8.s --run-prefix "sde --"
llvm-lit ./llvm/test/MC/X86/abs8.s --run-prefix "qemu-x86_64"
Although LLVM test suites supports CMAKE variable TEST_SUITE_RUN_UNDER, it does not work for me.
When I built llvm-test-suite with command like cmake -DTEST_SUITE_RUN_UNDER="sde --", and then ran llvm-lit, the result looked like
bash$ llvm-lit -v llvm-test-suite/build/SingleSource/Regression/C++/Regression-C++-2011-03-28-Bitfield.test -a llvm-test-suite/build/tools/timeit-target --limit-core 0 --limit-cpu 7200 --timeout 7200 --limit-file-size 104857600 --limit-rss-size 838860800 --append-exitstatus --redirect-output llvm-test-suite/build/SingleSource/Regression/C++/Output/Regression-C++-2011-03-28-Bitfield.test.out --redirect-input /dev/null --chdir llvm-test-suite/build/SingleSource/Regression/C++ --summary llvm-test-suite/build/SingleSource/Regression/C++/Output/Regression-C++-2011-03-28-Bitfield.test.time sde -- llvm-test-suite/build/SingleSource/Regression/C++/Regression-C++-2011-03-28-Bitfield
It tried to run Regression-C++-2011-03-28-Bitfield on the simulator, however the tool timeit-target was built with same flags, which has illegal instructions too. So the LIT ran fail.
In addition, it looks more reasonable to add the prefix during the run process than build process.
Discussion: https://discourse.llvm.org/t/rfc-prefix-test-invocations-with-the-given-tool-for-llvm-lit/70611