[CMake] Subset testing with CTest

David Cole david.cole at kitware.com
Wed Sep 12 14:54:08 EDT 2012


Similar to running 'make' in a sub-directory to build just that
directory and below... running 'ctest' in a sub-directory will just
run the tests for that directory.

Are you asking to be able just to run the tests, or to submit just
those tests to a dashboard?

Just running them is already possible. Sending them to a dashboard,
you'd have to use the -R matching technique...



On Wed, Sep 12, 2012 at 2:21 PM, Leif Walsh <leif.walsh at gmail.com> wrote:
> I prefix test names with the name of the component they test, so
>
> a/tests/CMakeLists.txt:
> add_test(a/test_foo test_foo)
>
> b/tests/CMakeLists.txt:
> add_test(b/test_foo test_foo)
>
> Then, ctest -R '^a/' from toplevel works.
>
> Sent from my iPhone
>
> On Sep 12, 2012, at 14:12, Robert Dailey <rcdailey.lists at gmail.com> wrote:
>
>> The source repository at our company is structured for two products.
>> Both products have a large amount of shared targets, but there are
>> certain subdirectories in the tree that are product-specific. Each of
>> the product-specific targets have their own unit tests (and all common
>> targets have them as well).
>>
>> When I want to build Product A, all I have to do is CD into product
>> A's subdirectory and initiate a build from there. I'd like a similar
>> feature for testing -- depending on which subdirectory we are in, we
>> can determine what to build, what to test.
>>
>> I was looking over the information on the CMake wiki here:
>> http://cmake.org/Wiki/CMake/Testing_With_CTest
>>
>> There is a section on specifying subsets. I can use regular
>> expressions or test indices, neither of which will work for our case.
>> There needs to be a way to specify tests for a single product.
>>
>> Right now the only thing we can do is run "ctest -D Experimental" at
>> the root, but this builds and tests both products at once. I want to
>> be able to only build and test Product A. Can I do this now? Is there
>> some workaround I can use, or perhaps a feature I'm not aware of?
>> --
>>
>> 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
> --
>
> 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