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()
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)
endfunction()
macro(maketestname testname reverted listsuspicious listignored listunreliable listlabels)
set(sublabel "")
string(REGEX MATCH "\\/[a-z][a-z](_[A-Z][A-Z])?\\/" _v ${${testname}})
if(_v)
string(REGEX REPLACE "\\/" "" _v ${_v})
set(listsuspiciousx ${listsuspicious}_${_v})
set(listignoredx ${listignored}_${_v})
set(listunreliablex ${listunreliable}_${_v})
set(listsuspendedx suspendedTests_${v})
else()
set(listsuspiciousx ${listsuspicious})
set(listignoredx ${listignored})
set(listunreliablex ${listunreliable})
set(listsuspendedx suspendedTests)
endif()
set(sublabel "")
set(sublabel "${${listlabels}}")
findexpr(mfound ${testname} ${listignoredx} sublabel)
if (NOT mfound)
string(REGEX MATCH "_(systemF|texF|pdf3|pdf2|pdf|dvi|lyx16|xhtml)$" _v ${${testname}})
# check if test _may_ be in listsuspicious
if (_v)
findexpr(mfound ${testname} ${listsuspiciousx} sublabel)
set(sublabel2 "")
findexpr(foundunreliable ${testname} ${listunreliablex} sublabel2)
if (foundunreliable)
set(sublabel "unreliable" ${sublabel} ${sublabel2})
list(REMOVE_ITEM sublabel "export" "reverted" "templates" "mathmacros" "manuals" "autotests")
else()
set(mfound OFF)
endif()
if (NOT mfound)
set(${reverted} 0)
else()
# Now that the test is suspect,
# check if it is unreliable, and/or suspended
string(REGEX MATCH "_(systemF|texF|pdf3|pdf2|pdf|dvi|lyx16|xhtml)$" _v ${${testname}})
# check if test _may_ be in listsuspicious
set(sublabel2 "")
findexpr(nsfound ${testname} ${listunreliablex} sublabel2)
findexpr(nsfound2 ${testname} suspendedTests 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)
if (_v)
findexpr(mfound ${testname} ${listsuspiciousx} sublabel2)
else()
set(sublabel "reverted" ${sublabel})
set(${reverted} 1)
set(mfound OFF)
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)
string(TOUPPER "${tmpprefixx}_" tmpprefix)
set(${testname} "${tmpprefix}${${testname}}")
string(TOUPPER "${sublabel}_" tmpprefix)
if (NOT sublabel STREQUAL "")
list(APPEND ${listlabels} ${sublabel})
list(FIND ${listlabels} "chemgreek" _i)
endif()
set(${listlabels} ${sublabel})
endif()
else()
set(${testname} "")
@ -237,30 +237,6 @@ loadTestList(ignoredTests ignoredTests)
loadTestList(suspendedTests suspendedTests)
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
foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates development/mathmacros)
set(testlabel "export")
@ -313,7 +289,7 @@ foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates develo
-DTOP_SRC_DIR=${TOP_SRC_DIR}
-DPERL_EXECUTABLE=${PERL_EXECUTABLE}
-P "${TOP_SRC_DIR}/development/autotests/export.cmake")
handlesuspended(${TestName} ${reverted} mytestlabel) # checking for suspended lyx16 exports
setmarkedtestlabel(${TestName} ${reverted} ${mytestlabel})
endif()
if(LYX_PYTHON_EXECUTABLE)
set(lyx2lyxtestlabel "lyx2lyx")
@ -330,7 +306,7 @@ foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates develo
"-DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}"
"-DLYXFILE=${LIBSUB_SRC_DIR}/${f}.lyx"
-P "${TOP_SRC_DIR}/development/autotests/lyx2lyxtest.cmake")
handlesuspended(${TestName} ${reverted} mytestlabel)
setmarkedtestlabel(${TestName} ${reverted} ${mytestlabel})
endif()
endif()
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
-DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
-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)
endif()
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}
-DPERL_EXECUTABLE=${PERL_EXECUTABLE}
-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()
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))
# Language nesting, document is OK, fails because of a bug in LyX
export/export/languagenesting1_dvi
export/export/languagenesting1_pdf
export/export/languagenesting1_pdf2
export/export/languagenesting1_pdf3
export/export/languagenesting1_(dvi|pdf(|[23]))