ctests: macro now deals with reverted and ignored

A single macro determines if a test should be ignored
(by returning an empty test name), and if not,
whether to revert it.

This was Kornel's idea.
This commit is contained in:
Scott Kostyshak 2013-08-23 00:03:29 -04:00
parent 036a78e990
commit a0f6b09a82

View File

@ -119,13 +119,18 @@ macro(getoutputformats filepath varname)
endforeach() endforeach()
endmacro() endmacro()
macro(getreverted testname reverted listreverted) macro(maketestname testname reverted listreverted listignored)
list(FIND ${listreverted} ${${testname}} _idx) list(FIND ${listignored} ${${testname}} _idx)
if (${_idx} LESS 0) if (${_idx} LESS 0)
set(${reverted} 0) list(FIND ${listreverted} ${${testname}} _idx)
if (${_idx} LESS 0)
set(${reverted} 0)
else()
set(${reverted} 1)
set(${testname} "INVERTED_SEE-README.ctest_${${testname}}")
endif()
else() else()
set(${reverted} 1) set(${testname} "")
set(${testname} "INVERTED_SEE-README.ctest_${${testname}}")
endif() endif()
endmacro() endmacro()
@ -163,40 +168,47 @@ foreach(libsubfolder doc examples templates)
# Strip extension # Strip extension
string(REGEX REPLACE "\\.lyx$" "" f ${f}) string(REGEX REPLACE "\\.lyx$" "" f ${f})
set(TestName "export/${libsubfolder}/${f}_lyx16") set(TestName "export/${libsubfolder}/${f}_lyx16")
getreverted(TestName reverted revertedTests) maketestname(TestName reverted revertedTests ignoredTests)
add_test(NAME ${TestName} if(TestName)
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}" add_test(NAME ${TestName}
COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
-Dlyx=$<TARGET_FILE:${_lyx}> COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME} -Dlyx=$<TARGET_FILE:${_lyx}>
-DLYX_USERDIR_VER=${LYX_USERDIR_VER} -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
-Dformat=lyx16x -DLYX_USERDIR_VER=${LYX_USERDIR_VER}
-Dextension=16.lyx -Dformat=lyx16x
-Dfile=${f} -Dextension=16.lyx
-Dreverted=${reverted} -Dfile=${f}
-P "${TOP_SRC_DIR}/development/autotests/export.cmake") -Dreverted=${reverted}
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
endif()
set(TestName "lyx2lyx/${libsubfolder}/${f}") set(TestName "lyx2lyx/${libsubfolder}/${f}")
getreverted(TestName reverted revertedTests) maketestname(TestName reverted revertedTests ignoredTests)
add_test(NAME ${TestName} if(TestName)
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}" add_test(NAME ${TestName}
COMMAND ${CMAKE_COMMAND} -DLYX2LYX=${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
-DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx COMMAND ${CMAKE_COMMAND} -DLYX2LYX=${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx
-P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake") -DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx
-P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake")
endif()
set(TestName "check_load/${libsubfolder}/${f}") set(TestName "check_load/${libsubfolder}/${f}")
getreverted(TestName reverted revertedTests) maketestname(TestName reverted revertedTests ignoredTests)
add_test(NAME ${TestName} if(TestName)
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}" add_test(NAME ${TestName}
COMMAND ${CMAKE_COMMAND} -DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
-Dlyx=$<TARGET_FILE:${_lyx}> COMMAND ${CMAKE_COMMAND} -DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx
-DPARAMS_DIR=${TOP_SRC_DIR}/development/autotests -Dlyx=$<TARGET_FILE:${_lyx}>
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME} -DPARAMS_DIR=${TOP_SRC_DIR}/development/autotests
-P "${TOP_SRC_DIR}/development/autotests/check_load.cmake") -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
-P "${TOP_SRC_DIR}/development/autotests/check_load.cmake")
else()
message("ignored test")
endif()
getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist) getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist)
foreach(format ${formatlist}) foreach(format ${formatlist})
set(TestName "export/${libsubfolder}/${f}_${format}") set(TestName "export/${libsubfolder}/${f}_${format}")
list(FIND ignoredTests ${TestName} _idx) maketestname(TestName reverted revertedTests ignoredTests)
if (${_idx} LESS 0) if(TestName)
getreverted(TestName reverted revertedTests)
add_test(NAME ${TestName} add_test(NAME ${TestName}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR} COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}