[CMake] cmake + valgrind + jenkins
Noah Roberts
roberts.noah at gmail.com
Mon Jul 16 02:37:57 EDT 2012
I've continued working on my original problem and gotten further. It
seems I was missing "include(CTest)" in my CMakeLists.txt
I still have one remaining issue though. I want the memcheck command
to CTest generate XML files for the Jenkins valgrind plugin. The
problem is that I don't see a way to parameterize the output. My
CMakeLists.txt contains:
set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
set(MEMORYCHECK_COMMAND_OPTIONS "--xml=yes --xml-file=test.xml")
This works somewhat the way I want but as expected the test.xml file
only contains the results of the last test that runs. I need a way
therefor to tell CTest to pass a name unique to each test to the
valgrind command option --xml-file. Can this be done?
My full CMakeLists.txt setup:
./CMakeLists.txt:
cmake_minimum_required(VERSION 2.6)
project(OOC)
set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
set(MEMORYCHECK_COMMAND_OPTIONS "--xml=yes --xml-file=test.xml")
include(CTest)
enable_testing()
add_subdirectory(test)
./test/CMakeLists.txt:
find_package(Boost)
find_package(Boost COMPONENTS unit_test_framework)
include(CTest)
function(add_boost_test name)
message("Adding test ${name} with files ${ARGN}")
add_executable(${name} ${ARGN})
target_link_libraries(${name} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
add_test(${name} ./${name} --report_level=no --log_level=all
--output_format=xml
--log_sink=${CMAKE_BINARY_DIR}/test_logs/${name}.xml)
endfunction()
# add_boost_test(First nothing.cpp)
add_boost_test(runtime runtime_test.cpp)
add_boost_test(Object Object_test.cpp)
--
http://crazycpp.wordpress.com
http://crazyeddiesbrain.wordpress.com
More information about the CMake
mailing list