Cmake export tests: Implemented multiple sublabels for each test.

This commit is contained in:
Kornel Benko 2015-11-27 15:12:47 +01:00
parent 960393b7a0
commit 4138ab7916

View File

@ -67,11 +67,19 @@ macro(findexpr found testname listname rsublabel)
set(_found 0) set(_found 0)
set(sublabel "") set(sublabel "")
foreach(_itrx ${${listname}}) foreach(_itrx ${${listname}})
if ("${_itrx}" MATCHES "^Sublabel:[ \t]*\([a-z]+\)[ \t]*$") if ("${_itrx}" MATCHES "^Sublabel:")
set(sublabel "${CMAKE_MATCH_1}")
if (sublabel STREQUAL "RESET")
set(sublabel "") set(sublabel "")
string(REGEX REPLACE "^Sublabel:[ \t]*" "" _itrlabels ${_itrx})
string(REGEX MATCHALL "([a-zA-Z]+)" _labels ${_itrlabels})
foreach(subl ${_labels})
if (subl STREQUAL "RESET")
set(sublabel "")
else()
list(APPEND sublabel ${subl})
endif() endif()
endforeach()
# remove doubles in sublabel
list(REMOVE_DUPLICATES sublabel)
else() else()
set(_itr "^${_itrx}$") set(_itr "^${_itrx}$")
if (${testname} MATCHES "${_itr}") if (${testname} MATCHES "${_itr}")
@ -88,6 +96,11 @@ macro(findexpr found testname listname rsublabel)
set(${found} ${_found}) set(${found} ${_found})
endmacro() endmacro()
function(join rvalues glue routput)
string(REGEX REPLACE "([^\\]|^);" "\\1${glue}" out "${${rvalues}}")
set(${routput} ${out} PARENT_SCOPE)
endfunction()
macro(maketestname testname reverted listreverted listignored listunreliable listlabels) macro(maketestname testname reverted listreverted listignored listunreliable listlabels)
set(sublabel "") set(sublabel "")
string(REGEX MATCH "\\/[a-z][a-z](_[A-Z][A-Z])?\\/" _v ${${testname}}) string(REGEX MATCH "\\/[a-z][a-z](_[A-Z][A-Z])?\\/" _v ${${testname}})
@ -109,7 +122,8 @@ macro(maketestname testname reverted listreverted listignored listunreliable lis
if (nsfound) if (nsfound)
if (NOT "${sublabel}" STREQUAL "") if (NOT "${sublabel}" STREQUAL "")
list(APPEND ${listlabels} ${sublabel}) list(APPEND ${listlabels} ${sublabel})
string(TOUPPER "${sublabel}_" tmpprefix) join(sublabel "." tmpprefixx)
string(TOUPPER "${tmpprefixx}_" tmpprefix)
else() else()
set(tmpprefix "") set(tmpprefix "")
endif() endif()
@ -165,12 +179,15 @@ macro(loadTestList filename resList)
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:[ \t]*\([a-zA-Z]+\)") if (_newl MATCHES "^Sublabel:")
set(labname ${CMAKE_MATCH_1}) string(REGEX REPLACE "^Sublabel:[ \t]*" "" _newlabels ${_newl})
string(REGEX MATCHALL "([a-zA-Z]+)" _labels ${_newlabels})
foreach(labname ${_labels})
if (NOT labname STREQUAL "RESET") if (NOT labname STREQUAL "RESET")
list(REMOVE_ITEM mylabels ${labname}) list(REMOVE_ITEM mylabels ${labname})
list(APPEND mylabels ${labname}) list(APPEND mylabels ${labname})
endif() endif()
endforeach()
set(sublabel ${_newl}) set(sublabel ${_newl})
endif() endif()
if(_vx) if(_vx)