[llvm-dev] Running clang tests

Alexandre Ganea via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 10 15:47:02 PDT 2020


We are fixing the issues :-) clang-cl doesn’t currently support /MP which makes building of each project single-threaded with MSBuild. I have a patch ongoing here: https://reviews.llvm.org/D52193 – I am working on it since last week to iron out the last issues, I’ll update it soon.
Without that you have to resort to increasing the “maximum number of parallel builds” to a higher value than the default 2.

De : Chris Tetreault <ctetreau at quicinc.com>
Envoyé : April 10, 2020 6:36 PM
À : Alexandre Ganea <alexandre.ganea at ubisoft.com>; Sudhindra kulkarni <sudhindrakkulkarni102 at gmail.com>
Cc : LLVM Dev <llvm-dev at lists.llvm.org>
Objet : RE: [llvm-dev] Running clang tests


   I’d just like to interject to say that building within Visual Studio isn’t really that bad. Running the lit tests is a bit painful because the LLVM build tools that are integrated with the build system don’t play nice with msbuild. Particularly, I’ve never been able to actually cancel an invocation of lit or tablegen via visual studio. That said, there is a huge upside to building with Visual Studio: actually being able to use the debugger.

   Honestly, I find this “just use ninja” attitude frustrating and troubling. If there are pain points with using MSVC or make or whatever, we should be trying to fix then, not just throwing our hands up in the air giving up. In my opinion, most of the issues surrounding using make or msbuild stem from the fact that nobody is using these build systems, so nobody is fixing the issues. I feel that we should be encouraging people to use the build system that they prefer, and encouraging people to fix the build system to work well with their chosen build system. This is the only way that things will get better.

   Sudhindra, to answer your question, I would also recommend upgrading to Visual Studio 2019 if you can. I just tried to directly run ASTMatcherTests from Visual Studio 2019 and it worked for me. I have no experience with the GTest IDE plugin, I’ve always just ran GTest binaries directly. There’s also a check-clang (I think that’s the one you want. It might be called something else but it’s definitely there) target in there that is equivalent to the Ninja check-clang target. These check targets are weird because to run them you have to do “build” from Visual Studio. If you try to actually run the target it won’t work. This is one of those things that would probably get fixed if people actually used the LLVM Visual Studio project.

   Christopher Tetreault

From: llvm-dev <llvm-dev-bounces at lists.llvm.org<mailto:llvm-dev-bounces at lists.llvm.org>> On Behalf Of Alexandre Ganea via llvm-dev
Sent: Friday, April 10, 2020 1:35 PM
To: Sudhindra kulkarni <sudhindrakkulkarni102 at gmail.com<mailto:sudhindrakkulkarni102 at gmail.com>>; LLVM Dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>>
Subject: [EXT] Re: [llvm-dev] Running clang tests


LLVM requires Visual Studio 2017 or 2019: https://llvm.org/docs/GettingStartedVS.html#software – you could use Community 2019.

I don’t recommend building LLVM inside Visual Studio. However you can generate or update the VS solution once in a while:

  *   mkdir buildVS && cd buildVS
  *   cmake {your_llvm_root}/llvm -G"Visual Studio 16 2019" -Thost=x64 -DLLVM_ENABLE_PROJECTS=clang;llvm -DLLVM_OPTIMIZED_TABLEGEN=ON

Use Ninja instead for building: https://ninja-build.org/ it’s a lot faster - keep Visual Studio only for debugging.
Ensure ninja.exe is in %PATH%.

From a Visual Studio shell (“x64 Native Tools Command Prompt for VS 2019” in the Start menu) run the following:

  *   mkdir buildNinjaRel && cd buildNinjaRel
  *   cmake {your_llvm_root}/llvm -G"Ninja" -DLLVM_ENABLE_PROJECTS=clang;llvm -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_OPTIMIZED_TABLEGEN=ON
  *   ninja check-all

You can then debug the test in VS: {your_llvm_root}\buildNinjaRel\tools\clang\unittests\ASTMatchers\ASTMatchersTests.exe

Then re-run “ninja check-clang-unit” or just “ninja” if you want to iterate on code changes.


De : llvm-dev <llvm-dev-bounces at lists.llvm.org<mailto:llvm-dev-bounces at lists.llvm.org>> De la part de Sudhindra kulkarni via llvm-dev
Envoyé : April 10, 2020 6:42 AM
À : llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
Objet : [llvm-dev] Running clang tests

Hi Team,
                 I have checked out the clang and llvm source code and built the executables using the visual studio 2015 community edition. I am using Windows as my platform.

However I  see that there are some test cases under the clang test folder in the LLVM.sln. Eg AstMatcherTest,ASTTests etc. I see that these tests make use of the Google test framework.

In my visual studio I have installed Google Test Adapter extension for running the Google tests.

But the tests under AstMatcherTest,ASTTests projects won't show up in the Test Explorer view in visual studio even after building these projects.So I wanted to know the reason for the same.

So can you please let me know if it possible to run these tests in visual studio. If not how to run them.

Thanks in advance.

Thanks and Regards
Sudhindra Kulkarni

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

More information about the llvm-dev mailing list