Testing an LLVM IR pass


I wrote an LLVM IR pass and after testing it on relatively small pieces of code I want to
test it on the LLVM test suite in projects/test-suite. How can I specify to the test

infrastructure that I want to run my pass during the testing?

I also need to run an analysis tool on produced binaries before I can run it. Is there a way

to tell the test infrastructure to run a tool on produced binaries before executing them?

Is it also possible to build the test programs for another target and run them on a remote


Is running the test-suite with the Makefiles still a good option or should I use the LNT system?


Hi Jan,

This probably doesn’t answer all of your questions directly, but I’ve used the following
command line in the past using LNT to cross-compile the test suite and run the
binaries on qemu:

./bin/lnt runtest nt --sandbox ~/lnt_sandbox --cc ~/build/bin/clang --test-suite ~/test-suite \

–cxx ~/build/bin/clang \

–cflag=“-target aarch64-none-linux-gnu …” \

–llvm-arch=AArch64 --make-param RUNUNDER=~/qemu.sh --make-param USER_MODE_EMULATION=YES

Here, “qemu.sh” is a shell script that gets invoked to run the binary, so a similar approach could
probably be used to run the analysis tool you refer to (i.e. using the RUNUNDER parameter).

For remote execution; I’m not sure if it’s clearly documented anywhere, but it
seems lnt has --remote-{user, host, port, client} parameters to specify that.