Discussion:
[CMake] How to run tests in parallel?
Dave Ohlsson
2011-06-15 11:55:08 UTC
Permalink
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
Dave Ohlsson
2011-06-15 12:01:08 UTC
Permalink
Just found the answer:

make test ARGS=-j4

Sorry for the spam...

-- dave
Post by Dave Ohlsson
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.).
   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>)
   make test
This command runs all the tests SERIALLY, and they all pass.
Now, how could I run the tests IN PARALLEL?
   make -j4 test
   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
Kelly Thompson
2011-06-15 14:03:06 UTC
Permalink
Dave,

I usually run 'ctest -j4' because it is easier to type than 'make test
ARGS=j4'.

I think that 'make test ARGS=j4' will simply call ctest with '-j4' so the
commands should be equivalent.

-kt
-----Original Message-----
Of
Dave Ohlsson
Sent: Wednesday, June 15, 2011 6:01 AM
Subject: Re: [CMake] How to run tests in parallel?
make test ARGS=-j4
Sorry for the spam...
-- dave
Post by Dave Ohlsson
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.).
   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>)
   make test
This command runs all the tests SERIALLY, and they all pass.
Now, how could I run the tests IN PARALLEL?
   make -j4 test
   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
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.cmake.org/Wiki/CMake_FAQ
http://www.cmake.org/mailman/listinfo/cmake
S Roderick
2011-06-15 11:59:21 UTC
Permalink
Post by Dave Ohlsson
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.).
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>)
make test
This command runs all the tests SERIALLY, and they all pass.
Now, how could I run the tests IN PARALLEL?
make -j4 test
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.
Undocumented feature (IIRC) ...

make -jN test # build in parallel
make test ARGS=-jN # run tests in parallel

for appropriate N
Loading...