[CMake] add_test/memcheck

cabieces julien cabieces.julien at gmail.com
Tue Aug 13 08:23:02 EDT 2013


FYI, I manage to make it work by adding this in my CMakeLists.txt

find_program(MEMORYCHECK_COMMAND NAMES valgrind)
set(MEMORYCHECK_COMMAND_OPTIONS "--xml=yes --xml-file=test.xml")
file(TO_CMAKE_PATH "${CMAKE_SOURCE_DIR}/resources/valgrind_supp.xml"
MEMORYCHECK_SUPPRESSIONS_FILE)
include(CTest)
enable_testing()
add_test(test myprogram)

I manage to correct my cmake file when I understand these declaration
modify the DartConfiguration.tcl, which is used by ctest.





2013/8/9 cabieces julien <cabieces.julien at gmail.com>

> not better
>
> my CMakeLists.txt :
>
> enable_testing()
> include(CTest) # don't know if it's necessary
> add_test(MyProgramTest ./program)
>
> my CTestCustom.cmake in the build dir :
> message("!!!! hello")
> set(CTEST_CUSTOM_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
> set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
> set(MEMORYCHECK_COMMAND "/usr/bin/valgrind")
>
> As you see, I have tried several variable, nothing change.
>
> I have tried to put these declaration in the CTestCustom.cmake and I have
> the following :
> terminate called after throwing an instance of 'std::logic_error'
>   what():  basic_string::_S_construct null not valid
>
> Thanks
>
> Julien
>
>
>
> 2013/8/8 Rolf Eike Beer <eike at sf-mail.de>
>
>> Am 08.08.2013 14:09, schrieb cabieces julien:
>>
>>  Hi
>>>
>>> I'm currently using the simple way of testing in Cmake, just adding the
>>> two
>>> following instructions at the end of my CMakeLists.txt;
>>>
>>> enable_testing()
>>> add_test(TestMyProgram MyProgram)
>>>
>>> I follow this instruction : http://cmake.org/Wiki/CMake/**
>>> Testing_With_CTest <http://cmake.org/Wiki/CMake/Testing_With_CTest>
>>>
>>> and I would like to make memory checking (and eventually coverage)
>>>
>>> In order to do it, I just add "include(CTest)" after enable_testing, and
>>> type in a terminal
>>>
>>> ctest -D ExperimentalMemCheck
>>>
>>> but now, I would like to customize memchecking (I use valgrind) by
>>> setting
>>> a suppression file and tell valgrind to produce a xml-file (that could
>>> used
>>> in an other tool or maybe Jenkins).
>>>
>>> So according to the documentation I add
>>> file(TO_CMAKE_PATH "${CMAKE_SOURCE_DIR}/**resources/valgrind_supp.xml"
>>> MEMORYCHECK_SUPPRESSIONS_FILE)
>>> set(MEMORYCHECK_COMMAND_**OPTIONS "--xml=yes
>>> --xml-file=test_memcheck.xml")
>>>
>>
>> You must put these into CTestCustom.cmake in your build dir.
>>
>> Eike
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/**CMake_FAQ<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<http://cmake.org/cmake/help/support.html>
>> CMake Consulting: http://cmake.org/cmake/help/**consulting.html<http://cmake.org/cmake/help/consulting.html>
>> CMake Training Courses: http://cmake.org/cmake/help/**training.html<http://cmake.org/cmake/help/training.html>
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/**
>> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/**listinfo/cmake<http://www.cmake.org/mailman/listinfo/cmake>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130813/c28e7f2d/attachment-0001.htm>


More information about the CMake mailing list