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

Amara Emerson via llvm-dev
Mon, 07 May 2018 14:03:07 -0000

> On 7 May 2018, at 11:01, Sedat Dilek via llvm-dev <llvm-dev at
lists.llvm.org> wrote:
>
> On Mon, May 7, 2018 at 5:52 AM, Brian Cain <brian.cain at gmail.com
<mailto:brian.cain at gmail.com>> wrote:
>> 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
>>
>
> Hi Brian,
>
> The cmake-line should be...
>
> # apt-get install ninja-build
> $ cmake -G Ninja ../llvm
>
> Unfortunately, on the latest Git my build fails which gcc-7 (see
> attached file for details).
> Do I really need to build clang-from-git?
> I have llvm-7/clang-7 binaries installed on my system?
>
> But I run the test after symlinking clang-7 ---> clang...
>
> $ ./bin/llvm-lit -v ./tools/clang/test/Sema/asm.c
> llvm-lit: /home/sdi/src/llvm/llvm/utils/lit/lit/llvm/config.py:334:
> note: using clang: /usr/bin/clang
> llvm-lit: /home/sdi/src/llvm/llvm/utils/lit/lit/llvm/subst.py:126:
> note: Did not find c-index-test in
> /home/sdi/src/llvm/build/./bin:/home/sdi/src/llvm/build/./bin
> llvm-lit: /home/sdi/src/llvm/llvm/utils/lit/lit/llvm/subst.py:126:
> note: Did not find clang-check in
> /home/sdi/src/llvm/build/./bin:/home/sdi/src/llvm/build/./bin
> llvm-lit: /home/sdi/src/llvm/llvm/utils/lit/lit/llvm/subst.py:126:
> note: Did not find opt in
> /home/sdi/src/llvm/build/./bin:/home/sdi/src/llvm/build/./bin


That looks like your system ran out of memory during linking, which on debug
builds is possible especially if you use parallel jobs with -j. You can’t use a
different clang binary to run tests and expect them to work, the tests are
specific to each individual version of the compiler.

Try using -DCMAKE_BUILD_TYPE=Release which requires less memory to link, unless
you really need debug info in the binary, in which case try running ninja -j1 to
avoid parallel jobs.

Amara
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180507/27699945/attachment-0001.html>