[cfe-dev] [check-clang][lit] can I just run my own test case in when using `make check-clang`?
Robinson, Paul via cfe-dev
cfe-dev at lists.llvm.org
Mon Nov 9 06:56:53 PST 2020
There are several different kinds of tests within the project. You might want to read through https://llvm.org/docs/TestingGuide.html to get an overview.
Lit tests (at least for Clang) are generally C/C++ sources intended to be inputs to clang; various compiler outputs are verified, usually with the FileCheck tool. These test files are not built into a bin with all the other tests. You should be able to use llvm-lit.py to run either a single test file, or one subdirectory (e.g., `llvm-lit clang/test/Sema` will run all the tests in Sema).
Individual lit tests can express requirements on the environment, and if these are not satisfied, llvm-lit will report UNSUPPORTED. clang/test/Frontend/plugin-attribute.cpp is probably UNSUPPORTED because the test file contains the line `REQUIRES: plugins, examples` and those dependencies are not satisfied on your system.
Unit tests are cpp sources that directly call Clang or LLVM APIs in some way, e.g., using libTooling. If that’s what you wrote, then you don’t want a lit test, you want to add your file to a unittest (or add a new unittest). I think you can build the unittest programs with `make clang-test-depends` (that’s the correct target name for ninja, not sure about make).
Hope this helps,
--paulr
From: cfe-dev <cfe-dev-bounces at lists.llvm.org> On Behalf Of Yafei Liu via cfe-dev
Sent: Sunday, November 8, 2020 10:19 PM
To: Clang Dev <cfe-dev at lists.llvm.org>
Subject: Re: [cfe-dev] [check-clang][lit] can I just run my own test case in when using `make check-clang`?
Weird thing is that if I run ./bin/llvm-lit -v ./tools/clang/test/Sema/asm.c, it works
But if I run ./bin/llvm-lit -v ./tools/clang/test/Frontend/plugin-attribute.cpp it says
UNSUPPORTED: Clang :: Frontend/plugin-attribute.cpp (1 of 1)
On Mon, Nov 9, 2020 at 11:05 AM Yafei Liu <yfliu at mobvoi.com<mailto:yfliu at mobvoi.com>> wrote:
I worte a reguation test and want to check if my code works, but it seems that I have to run `make check-clang`, and it will run all the tests belongs to check-clang, which takes a lot of times.
Since the test case is a cpp file and build into a bin with other tests (correct if I'm wrong), I can't use things like llvm-lit llvm-project/clang/test/Frontend/mytest.cpp
So anyway I can run "mytest" singlely?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201109/3b8e9884/attachment.html>
More information about the cfe-dev
mailing list