[solved] cmake doesn't run all tests

classic Classic list List threaded Threaded
3 messages Options
Hex
Reply | Threaded
Open this post in threaded view
|

[solved] cmake doesn't run all tests

Hex
This post was updated on .
> hello,
>
> I have two modules in my CMake project:
>
> /root//
> //├── foo//
> //│   ├── CMakeLists.txt//
> //│   ├── src//
> //│   │   └── foo.c//
> //│   └── tests//
> //│       ├── foo_unit_test.c//
> //│       └── CMakeLists.txt//
> //├── CMakeLists.txt//
> //└── moo//
> //    ├── CMakeLists.txt//
> //    ├── src//
> //    │   └── moo.c//
> //    └── tests//
> //        ├── CMakeLists.txt//
> //        └── moo_unit_test.c//
> /
> my root project has:
>
> /enable_testing()//
> //
> //add_subdirectory(adder)//
> //add_subdirectory(viterbi_encoder)/
>
>
> and each module has:
>
> /add_subdirectory(tests)/
>
>
> For the tests I am using add_test() and make all test.
>
> yet, this only runs the tests within the first add_subdirectory. Other
> modules are ignored.
>
> How can I run all tests at once?
>
> Thank you in advance.
>

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake doesn't run all tests

Eric Noulard


Le mar. 21 mai 2019 à 11:45, hex <[hidden email]> a écrit :
hello,

I have two modules in my CMake project:

root
├── foo
│   ├── CMakeLists.txt
│   ├── src
│   │   └── foo.c
│   └── tests
│       ├── foo_unit_test.c
│       └── CMakeLists.txt
├── CMakeLists.txt
└── moo
    ├── CMakeLists.txt
    ├── src
    │   └── moo.c
    └── tests
        ├── CMakeLists.txt
        └── moo_unit_test.c

my root project has:

enable_testing()

add_subdirectory(adder)
add_subdirectory(viterbi_encoder)


and each module has:

add_subdirectory(tests)


For the tests I am using add_test() and make all test.

yet, this only runs the tests within the first add_subdirectory. Other modules are ignored.

Do the CMakeLists.txt in the sub-directory have their own project command or is your main top-level CMakeLists.txt the only CMakeLists.txt with project  command ?

How can I run all tests at once?

How do yu run the tests?

make tests ?
ninja tests ?
ctest ?

What does 
$ ctest -N
says?

This should work at least it "works-for-me" so there must be some difference between the CMakeLists.txt in the directory that works and in the directory that does not.
Do you have a sample setup which exhibit the issue that you can share?


Thank you in advance.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


--
Eric

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Hex
Reply | Threaded
Open this post in threaded view
|

Re: cmake doesn't run all tests

Hex

hello Eric,

Some of my recent changes prevented my function to add a build target. It was building either one or the other but not both. Therefore, half of the tests where missing.

You are right it is working correctly now.

thank you for your patience.

This should work at least it "works-for-me" so there must be some difference between the CMakeLists.txt in the directory that works and in the directory that does not.
Do you have a sample setup which exhibit the issue that you can share?


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake