Tejas Joshi via llvm-dev
2021-Mar-30 15:25 UTC
[llvm-dev] Running LIT based testcases outside of llvm source
Hello, So far, I have been copying .ll lit bases test cases in some /llvm-project/llvm/test/<directory> and then running them with /build-dir/bin/llvm-lit. Now, I need to run these test cases without adding them to llvm source, using /build-dir/bin/llvm-lit or /install-dir/bin/llvm-lit So to create similar test suite environment outside of source, I followed: <https://medium.com/@mshockwave/using-llvm-lit-out-of-tree-5cddada85a78> with some relevant changes but I am stumbling on error: AttributeError: 'TestingConfig' object has no attribute 'my_obj_root' Any changes that I am missing here? OR Regardless of the above link. Is there a simpler way to do this where I can run any IR based test cases outside of llvm source while referring to the corresponding tool in /build-dir/bin/ or /install-dir/bin/? Thanks, Tejas
Min-Yih Hsu via llvm-dev
2021-Mar-31 05:32 UTC
[llvm-dev] Running LIT based testcases outside of llvm source
Hi, I'm the author of that blog post. Without knowing the details of your issue, my guess is that somehow LIT didn't execute the correct config file. Long story short, there are two LIT config files: The one you put in source directory (lit.cfg.py) and the other one (lit.site.cfg.py), which is generated from a template file (lit.site.cfg.py.in), in the build direcotry The latter one is the config file LIT should execute first, because it's actually a trampoline that sets up some environment -- the my_obj_root is one of them -- before executing the real config file, lit.cfg.py in the source directory. To answer your section question, there _is_ a simpler way to run LIT: Write a simple lit.cfg.py, put side by side with your test file, and launch LIT at the same directory, period. IIRC this is also the example I showed at the beginning of the blog post. The problem is, if you have a separate build directory -- just like LLVM or most of the CMake-based projects -- you will have a hard time configuring the path to your program using this simple setup. The fancy trampoline trick adopted by LLVM is only designed to configure the paths to various tools -- like clang and opt -- used in the test file. Hope that answer your question -Min On Tue, Mar 30, 2021 at 8:27 AM Tejas Joshi via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > So far, I have been copying .ll lit bases test cases in some > /llvm-project/llvm/test/<directory> > and then running them with > /build-dir/bin/llvm-lit. > > Now, I need to run these test cases without adding them to llvm source, > using > /build-dir/bin/llvm-lit > or > /install-dir/bin/llvm-lit > So to create similar test suite environment outside of source, I followed: > <https://medium.com/@mshockwave/using-llvm-lit-out-of-tree-5cddada85a78> > with some relevant changes but I am stumbling on error: > AttributeError: 'TestingConfig' object has no attribute 'my_obj_root' > > Any changes that I am missing here? > > OR > Regardless of the above link. Is there a simpler way to do this where > I can run any IR based test cases outside of llvm source while > referring to the corresponding tool in /build-dir/bin/ or > /install-dir/bin/? > > Thanks, > Tejas > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Min-Yih Hsu Ph.D Student in ICS Department, University of California, Irvine (UCI). -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210330/186438d1/attachment.html>