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,7 +119,9 @@ macro(getoutputformats filepath varname)
endforeach()
endmacro()
macro(getreverted testname reverted listreverted)
macro(maketestname testname reverted listreverted listignored)
list(FIND ${listignored} ${${testname}} _idx)
if (${_idx} LESS 0)
list(FIND ${listreverted} ${${testname}} _idx)
if (${_idx} LESS 0)
set(${reverted} 0)
@ -127,6 +129,9 @@ macro(getreverted testname reverted listreverted)
set(${reverted} 1)
set(${testname} "INVERTED_SEE-README.ctest_${${testname}}")
endif()
else()
set(${testname} "")
endif()
endmacro()
macro(loadTestList filename resList)
@ -163,7 +168,8 @@ foreach(libsubfolder doc examples templates)
# Strip extension
string(REGEX REPLACE "\\.lyx$" "" f ${f})
set(TestName "export/${libsubfolder}/${f}_lyx16")
getreverted(TestName reverted revertedTests)
maketestname(TestName reverted revertedTests ignoredTests)
if(TestName)
add_test(NAME ${TestName}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}
@ -175,15 +181,19 @@ foreach(libsubfolder doc examples templates)
-Dfile=${f}
-Dreverted=${reverted}
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
endif()
set(TestName "lyx2lyx/${libsubfolder}/${f}")
getreverted(TestName reverted revertedTests)
maketestname(TestName reverted revertedTests ignoredTests)
if(TestName)
add_test(NAME ${TestName}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
COMMAND ${CMAKE_COMMAND} -DLYX2LYX=${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx
-DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx
-P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake")
endif()
set(TestName "check_load/${libsubfolder}/${f}")
getreverted(TestName reverted revertedTests)
maketestname(TestName reverted revertedTests ignoredTests)
if(TestName)
add_test(NAME ${TestName}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
COMMAND ${CMAKE_COMMAND} -DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx
@ -191,12 +201,14 @@ foreach(libsubfolder doc examples templates)
-DPARAMS_DIR=${TOP_SRC_DIR}/development/autotests
-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)
foreach(format ${formatlist})
set(TestName "export/${libsubfolder}/${f}_${format}")
list(FIND ignoredTests ${TestName} _idx)
if (${_idx} LESS 0)
getreverted(TestName reverted revertedTests)
maketestname(TestName reverted revertedTests ignoredTests)
if(TestName)
add_test(NAME ${TestName}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}