[CMake] How to run tests in parallel?

Dave Ohlsson dave.ohlsson at gmail.com
Wed Jun 15 08:01:08 EDT 2011


Just found the answer:

    make test ARGS=-j4

Sorry for the spam...

-- dave

On Wed, Jun 15, 2011 at 2:55 PM, Dave Ohlsson <dave.ohlsson at gmail.com> wrote:
> Hi,
>
> I am new to CMake.
>
> I have a project with a few tests. The tests are independent from each
> other (run in separate directories, etc.).
>
> In my project's CMakeLists.txt, I have:
>
>    enable_testing()
>    add_test(NAME test1 COMMAND <some command 1>)
>    add_test(NAME test2 COMMAND <some command 2>)
>    add_test(NAME test3 COMMAND <some command 3>)
>
> I can run the tests with this command (from the build directory):
>
>    make test
>
> This command runs all the tests SERIALLY, and they all pass.
>
> Now, how could I run the tests IN PARALLEL?
>
> I tried this:
>
>    make -j4 test
>
> and that:
>
>    make -j 4 test
>
> but the tests are run serially also with these commands.
>
> Note that `make -j 4' builds the objects (.o files) in parallel
> without problems. I have this problem only with tests.
>
> I suppose I am missing something very obvious.
>
> I use Linux.
>
> -- dave


More information about the CMake mailing list