commit 41447b12250c704e813e97edae425d1b0467c467
Author: Kornel Benko <[email protected]>
Date:   Sat Mar 26 13:06:14 2016 +0100

    Cmake export tests: Label handling
    
    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)

diff --git a/development/autotests/ExportTests.cmake 
b/development/autotests/ExportTests.cmake
index 2b84dd7..e4a65de 100644
--- a/development/autotests/ExportTests.cmake
+++ b/development/autotests/ExportTests.cmake
@@ -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)
diff --git a/development/cmake/modules/LyXMacros.cmake 
b/development/cmake/modules/LyXMacros.cmake
index a3db752..2e2f7d8 100644
--- a/development/cmake/modules/LyXMacros.cmake
+++ b/development/cmake/modules/LyXMacros.cmake
@@ -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)

Reply via email to