mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Cmake export tests: Check for reused labels included
Labels defined in .*Tests should be unique. Now at least a warning is produced.
This commit is contained in:
parent
e8211fb931
commit
c178c8ab32
@ -143,18 +143,29 @@ macro(maketestname testname reverted listreverted listignored listunreliable lis
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
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)
|
||||||
# Create list of strings from a file without comments
|
# Create list of strings from a file without comments
|
||||||
file(STRINGS ${filename} tempList ENCODING "UTF-8")
|
file(STRINGS ${filename} tempList ENCODING "UTF-8")
|
||||||
set(${resList})
|
set(${resList})
|
||||||
set(sublabel)
|
set(sublabel)
|
||||||
|
set(mylabels "")
|
||||||
foreach(_l ${tempList})
|
foreach(_l ${tempList})
|
||||||
set(_newl "${_l}")
|
set(_newl "${_l}")
|
||||||
string(REGEX REPLACE "[ \t]*#.*$" "" _newl "${_l}")
|
string(REGEX REPLACE "[ \t]*#.*$" "" _newl "${_l}")
|
||||||
if(_newl)
|
if(_newl)
|
||||||
string(REGEX REPLACE "(\\/|\\||\\(|\\))" " " _vxx ${_newl})
|
string(REGEX REPLACE "(\\/|\\||\\(|\\))" " " _vxx ${_newl})
|
||||||
string(REGEX MATCHALL " ([a-z][a-z](_[A-Z][A-Z])?) " _vx ${_vxx})
|
string(REGEX MATCHALL " ([a-z][a-z](_[A-Z][A-Z])?) " _vx ${_vxx})
|
||||||
if (_newl MATCHES "^Sublabel:")
|
if (_newl MATCHES "^Sublabel:[ \t]*\([a-zA-Z]+\)")
|
||||||
|
set(labname ${CMAKE_MATCH_1})
|
||||||
|
if (NOT labname STREQUAL "RESET")
|
||||||
|
list(REMOVE_ITEM mylabels ${labname})
|
||||||
|
list(APPEND mylabels ${labname})
|
||||||
|
endif()
|
||||||
set(sublabel ${_newl})
|
set(sublabel ${_newl})
|
||||||
endif()
|
endif()
|
||||||
if(_vx)
|
if(_vx)
|
||||||
@ -177,12 +188,20 @@ macro(loadTestList filename resList)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
foreach(_l ${mylabels})
|
||||||
|
list(FIND known_labels ${_l} _ff)
|
||||||
|
if (_ff GREATER -1)
|
||||||
|
message(STATUS "Label \"${_l}\" already in use. Reused in ${filename}")
|
||||||
|
else()
|
||||||
|
list(APPEND known_labels ${_l})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
loadTestList(revertedTests revertedTests)
|
loadTestList(revertedTests revertedTests new_labels)
|
||||||
loadTestList(ignoredTests ignoredTests)
|
loadTestList(ignoredTests ignoredTests new_labels)
|
||||||
loadTestList(suspendedTests suspendedTests)
|
loadTestList(suspendedTests suspendedTests new_labels)
|
||||||
loadTestList(unreliableTests unreliableTests)
|
loadTestList(unreliableTests unreliableTests new_labels)
|
||||||
|
|
||||||
macro(handlesuspended TestName reverted testlabel)
|
macro(handlesuspended TestName reverted testlabel)
|
||||||
set(mylabel ${${testlabel}})
|
set(mylabel ${${testlabel}})
|
||||||
|
Loading…
Reference in New Issue
Block a user