[CMake] Different memcheck options for different tests

David Cole david.cole at kitware.com
Mon Jan 23 14:57:47 EST 2012


On Mon, Jan 23, 2012 at 2:26 PM, Andreas Schuh
<andreas.schuh.84 at googlemail.com> wrote:
> Hi Roland,
>
> have you considered writing a CTest script which you would run as follows:
>
> ctest -S your_script.ctest
>
> ?
>
> In your CTest script, you can use the commands
>
> ctest_start()
> ctest_configure()
> ctest_build()
>
> set (CTEST_MEMORYCHECK_COMMAND_OPTIONS "...")
> ctest_memcheck() where you include only certain tests
>
> set (CTEST_MEMORYCHECK_COMMAND_OPTIONS "...")
> ctest_memcheck() where you include only certain tests
>
> set (CTEST_MEMORYCHECK_COMMAND_OPTIONS "...")
> ctest_memcheck() where you include only certain tests
>
> ...
>
> ctest_submit()
>
> Have a closer look at the documentation of these functions that you
> can use in your CTest script at
> http://www.cmake.org/cmake/help/ctest-2-8-docs.html#section_Commands.
>
> I am not certain if setting the CTEST_MEMORYCHECK_COMMAND_OPTIONS in
> between calls to ctest_memcheck() works as expected. Maybe you would
> need to do also the ctest_configure() and ctest_build() steps before
> again, but I would hope not...
>
> Andreas
>
>
> On Fri, Dec 16, 2011 at 5:05 PM, Roland Schulz <roland at utk.edu> wrote:
>> Hi,
>>
>> how can I specify different memcheck options (e.g.
>> CTEST_MEMORYCHECK_COMMAND_OPTIONS) for different tests. Ideally I
>> would like to be able to specify it depending on the test label or the
>> directory.
>>
>> Ideally I could run "ctest -D ExperimentalMemCheck" and each test
>> would be run with the respective options.
>> But it would also be OK to have to run ctest more than once for the
>> different labels.
>>
>> I have tried:
>> 1) setting CTEST_MEMORYCHECK_COMMAND_OPTIONS different in the
>> respective CMakeLists.txt per folder
>> 2) setting CTEST_MEMORYCHECK_COMMAND_OPTIONS as an environment
>> variable before executing ctest.
>>
>> This both doesn't seem to work.
>>
>> What would be the best approach to set different options for different tests?
>>
>> Roland
>>
>> --
>> ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
>> 865-241-1537, ORNL PO BOX 2008 MS6309
>> --
>>
>> 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

But be aware: each ctest_memcheck call will generate an xml file that
needs submitting to CDash. Each call overwrites the previous one's
file... To avoid losing data, also do a partial submit after each
memcheck call in this case.

Something like:

ctest_memcheck(...)
ctest_submit(PARTS MemCheck)

ctest_memcheck(...)
ctest_submit(PARTS MemCheck)


HTH,
David


More information about the CMake mailing list