[CMake] ctest: building test in parellel

Damian Dixon damian.dixon at gmail.com
Tue Jun 27 08:28:43 EDT 2017


> I'm not sure to understand.
​> ​
Do you want to **build** test in parallel or **run** test in parallel?

​I want to build a test in parallel.

​> How are you calling ctest?

ctest -V -R '^DDOTUT_x11$'


I'm only running one test executable at a time.


​> cmake
cmake
-DCMAKE_TOOLCHAIN_FILE=../../Build/buildconfigs/any-linux-gcc-x86_64.cmake
../../Build

The build system we have contains 30 odd external libraries and about 40 of
our own.
​
> make
make -j8

This builds everything but the tests.

We've been leaving the build of the tests to ctest upto now.

However ctest now appears to be building more than just the tests. Its not
rebuilding everything just some of the libraries.

make on its own seems to respect the dependencies and only rebuild what is
required unless I've run ctest.



On 27 June 2017 at 13:03, Eric Noulard <eric.noulard at gmail.com> wrote:

>
>
> 2017-06-27 13:32 GMT+02:00 Damian Dixon <damian.dixon at gmail.com>:
>
>> Hi,
>>
>> Is there anyway to build tests in parallel when using ctest?
>>
>
> I'm not sure to understand.
> Do you want to **build** test in parallel or **run** test in parallel?
>
>
>>
>> I am generating makefiles on Linux.
>>
>
> Then
>
> $ make -j 8
>
> should build in parallel.
>
>
>>
>> Part of the reason I am asking this is that if I pre-build the test for
>> some unknown reason ctest rebuilds the source files.
>>
>
> Then you have to verify your test dependencies. ctest should only run the
> tests not build then unless you call ctest
> with --build-xxx option.
>
> How are you calling ctest?
>
> ctest --parallel 8
> or
> ctest -j 8
>
> should run tests in parallel.
>
> This works for me (either parallel build or parallel test run) but I'm
> using ninja.
>
>
> Could you give us more detail on how you run cmake, make and ctest ?
>
>
> --
> Eric
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170627/ec7f7301/attachment.html>


More information about the CMake mailing list