Cmake export tests: More refactoring.

This commit is contained in:
Kornel Benko 2015-11-29 02:18:07 +01:00
parent 0ee4dff450
commit 5d51ec20b5
2 changed files with 38 additions and 65 deletions

View File

@ -97,64 +97,64 @@ macro(findexpr found testname listname rsublabel)
endmacro() endmacro()
function(join rvalues glue routput) function(join rvalues glue routput)
string(REGEX REPLACE "([^\\]|^);" "\\1${glue}" out "${${rvalues}}") set(locallist ${${rvalues}})
list(REMOVE_ITEM locallist "export" "lyx2lyx" "load")
string(REGEX REPLACE "([^\\]|^);" "\\1${glue}" out "${locallist}")
set(${routput} ${out} PARENT_SCOPE) set(${routput} ${out} PARENT_SCOPE)
endfunction() endfunction()
macro(maketestname testname reverted listsuspicious listignored listunreliable listlabels) macro(maketestname testname reverted listsuspicious listignored listunreliable listlabels)
set(sublabel "")
string(REGEX MATCH "\\/[a-z][a-z](_[A-Z][A-Z])?\\/" _v ${${testname}}) string(REGEX MATCH "\\/[a-z][a-z](_[A-Z][A-Z])?\\/" _v ${${testname}})
if(_v) if(_v)
string(REGEX REPLACE "\\/" "" _v ${_v}) string(REGEX REPLACE "\\/" "" _v ${_v})
set(listsuspiciousx ${listsuspicious}_${_v}) set(listsuspiciousx ${listsuspicious}_${_v})
set(listignoredx ${listignored}_${_v}) set(listignoredx ${listignored}_${_v})
set(listunreliablex ${listunreliable}_${_v}) set(listunreliablex ${listunreliable}_${_v})
set(listsuspendedx suspendedTests_${v})
else() else()
set(listsuspiciousx ${listsuspicious}) set(listsuspiciousx ${listsuspicious})
set(listignoredx ${listignored}) set(listignoredx ${listignored})
set(listunreliablex ${listunreliable}) set(listunreliablex ${listunreliable})
set(listsuspendedx suspendedTests)
endif() endif()
set(sublabel "") set(sublabel "${${listlabels}}")
findexpr(mfound ${testname} ${listignoredx} sublabel) findexpr(mfound ${testname} ${listignoredx} sublabel)
if (NOT mfound) if (NOT mfound)
string(REGEX MATCH "_(systemF|texF|pdf3|pdf2|pdf|dvi|lyx16|xhtml)$" _v ${${testname}}) set(sublabel2 "")
# check if test _may_ be in listsuspicious findexpr(foundunreliable ${testname} ${listunreliablex} sublabel2)
if (_v) if (foundunreliable)
findexpr(mfound ${testname} ${listsuspiciousx} sublabel) set(sublabel "unreliable" ${sublabel} ${sublabel2})
list(REMOVE_ITEM sublabel "export" "reverted" "templates" "mathmacros" "manuals" "autotests")
else() else()
set(mfound OFF) string(REGEX MATCH "_(systemF|texF|pdf3|pdf2|pdf|dvi|lyx16|xhtml)$" _v ${${testname}})
endif() # check if test _may_ be in listsuspicious
if (NOT mfound)
set(${reverted} 0)
else()
# Now that the test is suspect,
# check if it is unreliable, and/or suspended
set(sublabel2 "") set(sublabel2 "")
findexpr(nsfound ${testname} ${listunreliablex} sublabel2) if (_v)
findexpr(nsfound2 ${testname} suspendedTests sublabel2) findexpr(mfound ${testname} ${listsuspiciousx} sublabel2)
list(APPEND sublabel ${sublabel2})
if (nsfound)
set(sublabel "unreliable" ${sublabel})
endif()
if (nsfound2)
set(sublabel "suspended" ${sublabel})
endif()
list(REMOVE_DUPLICATES sublabel)
if (nsfound OR nsfound2)
list(APPEND ${listlabels} ${sublabel})
set(${reverted} 0)
else() else()
set(sublabel "reverted" ${sublabel}) set(mfound OFF)
set(${reverted} 1)
endif() endif()
if (mfound)
set(sublabel3 "")
findexpr(foundsuspended ${testname} ${listsuspendedx} sublabel3)
set(${reverted} 1)
if (foundsuspended)
set(sublabel "reverted" "suspended" ${sublabel} ${sublabel2} ${sublabel3})
list(REMOVE_ITEM sublabel "export")
else()
set(sublabel "reverted" ${sublabel} ${sublabel2} ${sublabel3})
endif()
else()
set(${reverted} 0)
endif()
endif()
list(REMOVE_DUPLICATES sublabel)
if (NOT sublabel STREQUAL "")
join(sublabel "." tmpprefixx) join(sublabel "." tmpprefixx)
string(TOUPPER "${tmpprefixx}_" tmpprefix) string(TOUPPER "${tmpprefixx}_" tmpprefix)
set(${testname} "${tmpprefix}${${testname}}") set(${testname} "${tmpprefix}${${testname}}")
string(TOUPPER "${sublabel}_" tmpprefix) string(TOUPPER "${sublabel}_" tmpprefix)
if (NOT sublabel STREQUAL "") set(${listlabels} ${sublabel})
list(APPEND ${listlabels} ${sublabel})
list(FIND ${listlabels} "chemgreek" _i)
endif()
endif() endif()
else() else()
set(${testname} "") set(${testname} "")
@ -237,30 +237,6 @@ loadTestList(ignoredTests ignoredTests)
loadTestList(suspendedTests suspendedTests) loadTestList(suspendedTests suspendedTests)
loadTestList(unreliableTests unreliableTests) loadTestList(unreliableTests unreliableTests)
macro(handlesuspended TestName reverted testlabel)
set(mylabel ${${testlabel}})
set(myreverted ${reverted})
set(sublabel)
# check for unreliable
if ("${TestName}" MATCHES "^UNRELIABLE")
list(REMOVE_ITEM mylabel "export" "reverted" "templates" "mathmacros" "manuals")
list(APPEND mylabel "unreliable")
set(myreverted 0)
elseif (${reverted})
# check suspension only for reverted tests
findexpr(tfound TestName suspendedTests sublabel)
if (tfound)
set(mylabel "suspended")
if (sublabel)
list(APPEND mylabel ${sublabel})
endif()
set(myreverted 0) # if test is to be suspended, remove the 'reverted' flag
endif()
endif()
setmarkedtestlabel(${TestName} ${myreverted} ${mylabel})
endmacro()
# preparing to add e.g. development/mathmacros to the foreach() loop # preparing to add e.g. development/mathmacros to the foreach() loop
foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates development/mathmacros) foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates development/mathmacros)
set(testlabel "export") set(testlabel "export")
@ -313,7 +289,7 @@ foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates develo
-DTOP_SRC_DIR=${TOP_SRC_DIR} -DTOP_SRC_DIR=${TOP_SRC_DIR}
-DPERL_EXECUTABLE=${PERL_EXECUTABLE} -DPERL_EXECUTABLE=${PERL_EXECUTABLE}
-P "${TOP_SRC_DIR}/development/autotests/export.cmake") -P "${TOP_SRC_DIR}/development/autotests/export.cmake")
handlesuspended(${TestName} ${reverted} mytestlabel) # checking for suspended lyx16 exports setmarkedtestlabel(${TestName} ${reverted} ${mytestlabel})
endif() endif()
if(LYX_PYTHON_EXECUTABLE) if(LYX_PYTHON_EXECUTABLE)
set(lyx2lyxtestlabel "lyx2lyx") set(lyx2lyxtestlabel "lyx2lyx")
@ -330,7 +306,7 @@ foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates develo
"-DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}" "-DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}"
"-DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx" "-DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx"
-P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake") -P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake")
handlesuspended(${TestName} ${reverted} mytestlabel) setmarkedtestlabel(${TestName} ${reverted} ${mytestlabel})
endif() endif()
endif() endif()
set(loadtestlabel "load") set(loadtestlabel "load")
@ -346,7 +322,7 @@ foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates develo
-DPARAMS_DIR=${TOP_SRC_DIR}/development/autotests -DPARAMS_DIR=${TOP_SRC_DIR}/development/autotests
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME} -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
-P "${TOP_SRC_DIR}/development/autotests/check_load.cmake") -P "${TOP_SRC_DIR}/development/autotests/check_load.cmake")
handlesuspended(${TestName} ${reverted} mytestlabel) setmarkedtestlabel(${TestName} ${reverted} ${mytestlabel})
set_tests_properties(${TestName} PROPERTIES RUN_SERIAL ON) set_tests_properties(${TestName} PROPERTIES RUN_SERIAL ON)
endif() endif()
getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist) getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist)
@ -379,7 +355,7 @@ foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates develo
-DTOP_SRC_DIR=${TOP_SRC_DIR} -DTOP_SRC_DIR=${TOP_SRC_DIR}
-DPERL_EXECUTABLE=${PERL_EXECUTABLE} -DPERL_EXECUTABLE=${PERL_EXECUTABLE}
-P "${TOP_SRC_DIR}/development/autotests/export.cmake") -P "${TOP_SRC_DIR}/development/autotests/export.cmake")
handlesuspended(${TestName} ${reverted} mytestlabel) # check for suspended pdf/dvi exports setmarkedtestlabel(${TestName} ${reverted} ${mytestlabel}) # check for suspended pdf/dvi exports
endif() endif()
endforeach() endforeach()
endforeach() endforeach()

View File

@ -218,7 +218,4 @@ export/mathmacros/testcases_master_child_.*
export/mathmacros/testcases_speed_(dvi|pdf|pdf[23]|(dvi3|pdf[45])_(texF|systemF)) export/mathmacros/testcases_speed_(dvi|pdf|pdf[23]|(dvi3|pdf[45])_(texF|systemF))
# Language nesting, document is OK, fails because of a bug in LyX # Language nesting, document is OK, fails because of a bug in LyX
export/export/languagenesting1_dvi export/export/languagenesting1_(dvi|pdf(|[23]))
export/export/languagenesting1_pdf
export/export/languagenesting1_pdf2
export/export/languagenesting1_pdf3