[CMake] How to run tests in parallel?

Kelly Thompson kgt at lanl.gov
Wed Jun 15 10:03:06 EDT 2011


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-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf
Of
> Dave Ohlsson
> Sent: Wednesday, June 15, 2011 6:01 AM
> To: cmake at cmake.org
> Subject: Re: [CMake] How to run tests in parallel?
> 
> 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
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list