Cmake tests:

Add tests the cmake-way. Now there is only _one_ target `test'
This commit is contained in:
Kornel Benko 2012-10-21 12:05:50 +02:00
parent 3485f728c2
commit ed5dfa9cd7
3 changed files with 22 additions and 10 deletions

View File

@ -9,6 +9,8 @@ cmake_minimum_required(VERSION 2.6.4)
set(LYX_PROJECT LyX)
enable_testing()
set(LYX_CMAKE_DIR "development/cmake")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/${LYX_CMAKE_DIR}/modules")

View File

@ -38,15 +38,14 @@ foreach(_src ${check_PROGRAMS})
string(REPLACE "check_" "" _srcx ${_src})
set(src_data_file "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}")
set(created_data_file "${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}_data")
add_custom_command(
OUTPUT "${created_data_file}"
COMMAND ${_src} > "${created_data_file}"
COMMAND ${CMAKE_COMMAND} -E compare_files "${src_data_file}" "${created_data_file}"
DEPENDS ${_src} "${src_data_file}"
COMMENT "${_src} > '${created_data_file}'"
)
list(APPEND _depends "${created_data_file}")
add_test(NAME build_${_srcx}
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${_src})
add_test(NAME data_${_srcx}
COMMAND ${_src} > "${created_data_file}")
add_test(NAME compare_${_srcx}
COMMAND ${CMAKE_COMMAND} -E compare_files "${src_data_file}" "${created_data_file}")
set_tests_properties(data_${_srcx} PROPERTIES DEPENDS build_${_srcx} )
set_tests_properties(compare_${_srcx} PROPERTIES DEPENDS data_${_srcx})
endforeach()
add_custom_target(checkregfiles DEPENDS support ${_depends})

View File

@ -30,5 +30,16 @@ ADD_CUSTOM_COMMAND(
"${CMAKE_CURRENT_BINARY_DIR}"
)
ADD_CUSTOM_TARGET(test DEPENDS ${_tex2lyx} ${_lyx} ${_test_output})
#ADD_CUSTOM_TARGET(test DEPENDS ${_tex2lyx} ${_lyx} ${_test_output})
add_test(NAME build_tex2lyx
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${_tex2lyx})
add_test(NAME roundtrip_tex2lyx
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_SRC_DIR}/src/tex2lyx/test/runtests.py"
"${TOP_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${_tex2lyx}"
"${TOP_SRC_DIR}/lib/scripts"
"${CMAKE_CURRENT_BINARY_DIR}")
set_tests_properties(roundtrip_tex2lyx PROPERTIES DEPENDS build_tex2lyx)