Testing our CMake Modules

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

Testing our CMake Modules

Ramold, Felix

We created multiple additional functions for CMake. They became quite a lot, and we need to (unit) test them.

There are simple ones, that are only variable bases like:

function(join_list LIST GLUE)

These can be tested with a custom CMake Script, that checks the results. For this we also wrote a set of assert-macros.

This becomes way harder when the functions are target based:

function(target_my_custom_property_set TARGET VALUE)

We need a multiple CMakeLists.txt Files that need to be configured. Configuration must succeed or fail with specified messages. Also the result files must be checked.

I wonder, is there an easier way? Is there a existing framework? How does Kitware test the shipped modules?

Note: My original Stackoverflow question: https://stackoverflow.com/questions/51948060/testing-our-cmake-modules

 

Thanks,

Felix


--

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: Testing our CMake Modules

Kai Wolf
They (Kitware) typically write custom .cmake files to test the function/macro under test coupled together with a CMakeLists.txt file and/or a small C/C++ implementation file. Look here [1] for some examples, for instance CMake/Tests/MacroTest.

Greetings,

Kai

http://kai-wolf.me
http://effective-cmake.com

[1] https://github.com/Kitware/CMake/tree/master/Tests

> Am 10.12.2018 um 13:30 schrieb Ramold, Felix <[hidden email]>:
>
> We created multiple additional functions for CMake. They became quite a lot, and we need to (unit) test them.
> There are simple ones, that are only variable bases like:
> function(join_list LIST GLUE)
> These can be tested with a custom CMake Script, that checks the results. For this we also wrote a set of assert-macros.
> This becomes way harder when the functions are target based:
> function(target_my_custom_property_set TARGET VALUE)
> We need a multiple CMakeLists.txt Files that need to be configured. Configuration must succeed or fail with specified messages. Also the result files must be checked.
> I wonder, is there an easier way? Is there a existing framework? How does Kitware test the shipped modules?
> Note: My original Stackoverflow question: https://stackoverflow.com/questions/51948060/testing-our-cmake-modules
>
> Thanks,
> Felix
> --
>
> 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

--

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

signature.asc (499 bytes) Download Attachment