[cfe-dev] [llvm-dev] [clang] Running a single testcase

Brian Cain via cfe-dev cfe-dev at lists.llvm.org
Sun May 6 20:52:22 PDT 2018


The simplest way to run a clang test case that I know of is to clone both
llvm and clang repos, run all the tests, then run an individual test.

IIRC like so:

git clone llvm ......
cd llvm/tools
git clone clang .....
cd ../../
mkdir build
cd build
cmake ../llvm
ninja check-clang
./bin/llvm-lit -v ./tools/clang/test/Sema/asm.c



On Sun, May 6, 2018 at 7:10 AM, Sedat Dilek via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi,
>
> while experimenting with llvmlinux on Debian/testing AMD64 I wanted to
> run some x86-64 ASM tests.
>
> I fell over [1] and wanted to run it.
>
> So, I cloned clang from Git...
>
> $ git clone https://github.com/llvm-mirror/clang.git
>
> I looked through some docs where I have seen I need "llvm-lit" or "lit.py".
> The Debian package llvm-7-tools from <apt.llvm.org> does ship "lit.py".
> Furthermore, I have installed llvm-7 and clang-7 packages.
> The version is 1:7~svn330207-1~exp1+0~20180417201234.1709~1.gbp6fb10d.
>
> [5,6] have some examples on running a single testcase:
>
> For example:
>
>   python C:\Tools\llvm\utils\lit\lit.py -sv
>   --param=build_mode=Win32 --param=build_config=Debug
>   --param=clang_site_config=C:\Tools\build\tools\clang\test\lit.site.cfg
>   C:\Tools\llvm\tools\clang\test\Sema\wchar.c
>
> I transformed this...
>
> $ python /usr/lib/llvm-7/build/utils/lit/lit.py -sv
> /home/sdi/src/linux-kernel/clang/test/Sema/asm.c
> lit.py: /usr/lib/llvm-7/build/utils/lit/lit/TestingConfig.py:101:
> fatal: unable to parse config file
> '/home/sdi/src/linux-kernel/clang/test/lit.cfg.py', traceback:
> Traceback (most recent call last):
>   File "/usr/lib/llvm-7/build/utils/lit/lit/TestingConfig.py", line
> 88, in load_from_path
>     exec(compile(data, path, 'exec'), cfg_globals, None)
>   File "/home/sdi/src/linux-kernel/clang/test/lit.cfg.py", line 25, in
> <module>
>     config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
> AttributeError: 'NoneType' object has no attribute 'use_lit_shell'
>
> Yes, I have a lit.cfg.py.
>
> $ LC_ALL=C ll clang/test/lit.*
> -rw-r--r-- 1 sdi sdi 5979 Apr 25 12:14 clang/test/lit.cfg.py
> -rw-r--r-- 1 sdi sdi 1906 Apr 25 12:14 clang/test/lit.site.cfg.py.in
>
> How can I create a lit.site.cfg.py to pass it as
> --param=clang_site_config=/path/to/lit.site.cfg.py?
>
> I have attached TestingConfig.py from llvm-7-tools and lit.cfg.py and
> lit.site.cfg.py.in from clang-git.
>
> What am I missing?
> What do I need to run a single clang testcase?
>
> Thanks in advance.
>
> Regards,
> - Sedat -
>
> [1] https://github.com/llvm-mirror/clang/raw/master/test/Sema/asm.c
> [2] https://llvm.org/docs/CommandGuide/lit.html
> [3] https://llvm.org/docs/TestingGuide.html
> [4] https://llvm.org/docs/TestSuiteMakefileGuide.html
> [5] http://clang.llvm.org/hacking.html
> [6] http://clang.llvm.org/hacking.html#testingCommands
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>


-- 
-Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180506/7d966a4e/attachment.html>


More information about the cfe-dev mailing list