From a0f6b09a82f680fbc109be9519dd7ee8cd7dab6e Mon Sep 17 00:00:00 2001 From: Scott Kostyshak Date: Fri, 23 Aug 2013 00:03:29 -0400 Subject: [PATCH] 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. --- development/autotests/CMakeLists.txt | 80 ++++++++++++++++------------ 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/development/autotests/CMakeLists.txt b/development/autotests/CMakeLists.txt index 293d764c46..ffd9ebea45 100644 --- a/development/autotests/CMakeLists.txt +++ b/development/autotests/CMakeLists.txt @@ -119,13 +119,18 @@ macro(getoutputformats filepath varname) endforeach() endmacro() -macro(getreverted testname reverted listreverted) - list(FIND ${listreverted} ${${testname}} _idx) +macro(maketestname testname reverted listreverted listignored) + list(FIND ${listignored} ${${testname}} _idx) 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() - set(${reverted} 1) - set(${testname} "INVERTED_SEE-README.ctest_${${testname}}") + set(${testname} "") endif() endmacro() @@ -163,40 +168,47 @@ foreach(libsubfolder doc examples templates) # Strip extension string(REGEX REPLACE "\\.lyx$" "" f ${f}) set(TestName "export/${libsubfolder}/${f}_lyx16") - getreverted(TestName reverted revertedTests) - add_test(NAME ${TestName} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}" - COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR} - -Dlyx=$ - -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME} - -DLYX_USERDIR_VER=${LYX_USERDIR_VER} - -Dformat=lyx16x - -Dextension=16.lyx - -Dfile=${f} - -Dreverted=${reverted} - -P "${TOP_SRC_DIR}/development/autotests/export.cmake") + 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} + -Dlyx=$ + -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME} + -DLYX_USERDIR_VER=${LYX_USERDIR_VER} + -Dformat=lyx16x + -Dextension=16.lyx + -Dfile=${f} + -Dreverted=${reverted} + -P "${TOP_SRC_DIR}/development/autotests/export.cmake") + endif() set(TestName "lyx2lyx/${libsubfolder}/${f}") - getreverted(TestName reverted revertedTests) - 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") + 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) - add_test(NAME ${TestName} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}" - COMMAND ${CMAKE_COMMAND} -DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx - -Dlyx=$ - -DPARAMS_DIR=${TOP_SRC_DIR}/development/autotests - -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME} - -P "${TOP_SRC_DIR}/development/autotests/check_load.cmake") + 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 + -Dlyx=$ + -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}