]> git.lyx.org Git - features.git/commitdiff
Cmake export tests: Label handling
authorKornel Benko <kornel@lyx.org>
Sat, 26 Mar 2016 12:06:14 +0000 (13:06 +0100)
committerKornel Benko <kornel@lyx.org>
Sat, 26 Mar 2016 12:06:14 +0000 (13:06 +0100)
In collaboration with Günter Milde:
1.) Allow char ':' be part of a ctest-label
2.) Eliminate redundant label naming and directory names
    (The testnames should not repeat the directory name)

development/autotests/ExportTests.cmake
development/cmake/modules/LyXMacros.cmake

index 2b84dd76173da86f1bb7a1e6eb9c540f389324f4..e4a65de37c137eb1003ee2110d59cb9703c2eb3a 100644 (file)
@@ -38,6 +38,9 @@ endif()
 
 set(potential_languages "ca" "cs" "da" "de" "el" "es" "eu" "fa" "fr" "gl" "he" "hu" "id" "it" "ja" "ko" "nb" "nl" "pl" "pt" "ro" "ru" "sk" "sl" "sr" "sv" "uk" "zh_CN")
 
+# Used to select labels from .*Tests files
+set(label_chars "[a-zA-Z:]+")
+
 macro(initLangVars varname)
   foreach(_l ${potential_languages})
     set(${varname}_${_l})
@@ -80,7 +83,7 @@ macro(findexpr found testname listname rsublabel)
     if ("${_itrx}" MATCHES "^Sublabel:")
       set(tmpsublabel "")
       string(REGEX REPLACE "^Sublabel:[ \t]*" "" _itrlabels ${_itrx})
-      string(REGEX MATCHALL "[a-zA-Z]+" _labels ${_itrlabels})
+      string(REGEX MATCHALL ${label_chars} _labels ${_itrlabels})
       foreach(subl ${_labels})
         if (subl STREQUAL "RESET")
           set(tmpsublabel "")
@@ -108,7 +111,13 @@ endmacro()
 
 function(join rvalues glue routput)
   set(locallist ${${rvalues}})
-  list(REMOVE_ITEM locallist "export" "lyx2lyx" "load")
+  set(removelist "export" "lyx2lyx" "load")
+  foreach(_l ${locallist})
+    if (depth_${_l} LESS 0)
+      list(APPEND removelist ${_l})
+    endif()
+  endforeach()
+  list(REMOVE_ITEM locallist ${removelist})
   string(REGEX REPLACE "([^\\]|^);" "\\1${glue}" out "${locallist}")
   set(${routput} ${out} PARENT_SCOPE)
 endfunction()
@@ -200,7 +209,7 @@ macro(loadTestList filename resList depth)
       list(APPEND ${resList} "${_newl}")
       if (_newl MATCHES "^Sublabel:")
         string(REGEX REPLACE "^Sublabel:[ \t]*" "" _newlabels ${_newl})
-        string(REGEX MATCHALL "([0-9]*[a-zA-Z]+)" _labels ${_newlabels})
+        string(REGEX MATCHALL "([0-9]*${label_chars})" _labels ${_newlabels})
         foreach(labname ${_labels})
           if (NOT labname STREQUAL "RESET")
             list(APPEND mylabels ${labname})
@@ -231,7 +240,7 @@ macro(loadTestList filename resList depth)
     endif()
   endforeach()
   foreach(_l1 ${mylabels})
-    if (_l1 MATCHES "^([0-9]+)([a-zA-Z]+)$")
+    if (_l1 MATCHES "^([0-9]+)(${label_chars})$")
       set(_l ${CMAKE_MATCH_2})
       set(depth1 ${CMAKE_MATCH_1})
     else()
@@ -265,7 +274,7 @@ endmacro()
 assignLabelDepth(0 "export" "key" "layout" "load" "lyx2lyx" "module" "roundtrip" "url")
 assignLabelDepth(1 "unreliable" "inverted")
 assignLabelDepth(2 "suspended")
-assignLabelDepth(3 "examples" "manuals" "mathmacros" "templates" "autotests")
+assignLabelDepth(-1 "examples" "manuals" "mathmacros" "templates" "autotests")
 
 loadTestList(suspiciousTests suspiciousTests 7)
 loadTestList(ignoredTests ignoredTests 0)
index a3db752f658dfe221d365dcfc3e66df57e2b17d4..2e2f7d89306a9e986de1d6deeaf71c21baf26764 100644 (file)
@@ -329,7 +329,7 @@ macro(sortlabellist listout)
     list(APPEND tmplist "${depth_${_lab}}${_lab}")
   endforeach()
   list(SORT tmplist)
-  string(REGEX REPLACE ";[0-9]+" ";" ${listout} ";${tmplist}")
+  string(REGEX REPLACE ";[-0-9]+" ";" ${listout} ";${tmplist}")
 endmacro()
 
 macro(createlabel reslabel first)