From cf3156d22d8a76008086e24651a1f496c5cc8db6 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Wed, 2 Dec 2015 22:18:43 +0100 Subject: [PATCH] Cmake export tests: Create concatenated labels in the form 'export:reverted:examples:chemgreek' --- development/autotests/ExportTests.cmake | 40 ++++++++++++++--------- development/cmake/modules/LyXMacros.cmake | 21 ++++++++++-- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/development/autotests/ExportTests.cmake b/development/autotests/ExportTests.cmake index f99646e89e..0e8c128558 100644 --- a/development/autotests/ExportTests.cmake +++ b/development/autotests/ExportTests.cmake @@ -161,12 +161,7 @@ macro(maketestname testname reverted listsuspicious listignored listunreliable l endif() endmacro() -# This labels should not be used in .*Tests files -set(known_labels "export" "key" "layout" "load" "lyx2lyx" - "examples" "manuals" "mathmacros" "reverted" "templates" "unreliable" "suspended" - "module" "roundtrip" "url") - -macro(loadTestList filename resList) +macro(loadTestList filename resList depth) # Create list of strings from a file without comments # ENCODING parameter is a new feature in cmake 3.1 if (CMAKE_VERSION VERSION_GREATER "3.1") @@ -222,7 +217,7 @@ macro(loadTestList filename resList) if (_ff GREATER -1) message(STATUS "Label \"${_l}\" already in use. Reused in ${filename}") else() - list(APPEND known_labels ${_l}) + assignLabelDepth(${depth} ${_l}) endif() endforeach() foreach(_lg ${languages}) @@ -232,10 +227,25 @@ macro(loadTestList filename resList) endforeach() endmacro() -loadTestList(suspiciousTests suspiciousTests) -loadTestList(ignoredTests ignoredTests) -loadTestList(suspendedTests suspendedTests) -loadTestList(unreliableTests unreliableTests) +# This labels should not be used in .*Tests files +set(known_labels "") +# Create depth info to each label +macro(assignLabelDepth depth) + foreach(_lab ${ARGN}) + list(APPEND known_labels ${_lab}) + set(depth_${_lab} ${depth}) + endforeach() +endmacro() + +assignLabelDepth(0 "export" "key" "layout" "load" "lyx2lyx" "module" "roundtrip" "url") +assignLabelDepth(1 "unreliable" "reverted") +assignLabelDepth(2 "suspended") +assignLabelDepth(3 "examples" "manuals" "mathmacros" "templates" "autotests") + +loadTestList(suspiciousTests suspiciousTests 7) +loadTestList(ignoredTests ignoredTests 0) +loadTestList(suspendedTests suspendedTests 6) +loadTestList(unreliableTests unreliableTests 5) # preparing to add e.g. development/mathmacros to the foreach() loop foreach(libsubfolderx autotests/export lib/doc lib/examples lib/templates development/mathmacros) @@ -289,7 +299,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") - setmarkedtestlabel(${TestName} ${reverted} ${mytestlabel}) + setmarkedtestlabel(${TestName} ${mytestlabel}) endif() if(LYX_PYTHON_EXECUTABLE) set(lyx2lyxtestlabel "lyx2lyx") @@ -306,7 +316,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") - setmarkedtestlabel(${TestName} ${reverted} ${mytestlabel}) + setmarkedtestlabel(${TestName} ${mytestlabel}) endif() endif() set(loadtestlabel "load") @@ -322,7 +332,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") - setmarkedtestlabel(${TestName} ${reverted} ${mytestlabel}) + setmarkedtestlabel(${TestName} ${mytestlabel}) set_tests_properties(${TestName} PROPERTIES RUN_SERIAL ON) endif() getoutputformats("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist) @@ -355,7 +365,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") - setmarkedtestlabel(${TestName} ${reverted} ${mytestlabel}) # check for suspended pdf/dvi exports + setmarkedtestlabel(${TestName} ${mytestlabel}) # check for suspended pdf/dvi exports endif() endforeach() endforeach() diff --git a/development/cmake/modules/LyXMacros.cmake b/development/cmake/modules/LyXMacros.cmake index 9b883989ed..c0dd65e236 100644 --- a/development/cmake/modules/LyXMacros.cmake +++ b/development/cmake/modules/LyXMacros.cmake @@ -321,10 +321,27 @@ macro(settestlabel testname) set_tests_properties(${testname} PROPERTIES LABELS "${_lab_list}") endmacro() -macro(setmarkedtestlabel testname reverted) - settestlabel(${testname} ${ARGN}) +macro(sortlabellist listout) + set(tmplist "") + foreach(_lab ${ARGN}) + list(APPEND tmplist "${depth_${_lab}}${_lab}") + endforeach() + list(SORT tmplist) + string(REGEX REPLACE "[0-9]+" "" ${listout} "${tmplist}") endmacro() +macro(createlabel reslabel first) + set(${reslabel} ${first}) + foreach(_lab ${ARGN}) + set(${reslabel} "${${reslabel}}:${_lab}") + endforeach() +endmacro() + +macro(setmarkedtestlabel testname) + sortlabellist(mynewlablelist ${ARGN}) + createlabel(mynewlabel ${mynewlablelist}) + settestlabel(${testname} ${mynewlabel}) +endmacro() macro(lyx_target_link_libraries _target) foreach(_lib ${ARGN}) -- 2.39.2