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(sublabel "")
foreach(_itrx ${${listname}})
if ("${_itrx}" MATCHES "^Sublabel:[ \t]*\([a-z]+\)[ \t]*$")
set(sublabel "${CMAKE_MATCH_1}")
if (sublabel STREQUAL "RESET")
set(sublabel "")
endif()
if ("${_itrx}" MATCHES "^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()
endforeach()
# remove doubles in sublabel
list(REMOVE_DUPLICATES sublabel)
else()
set(_itr "^${_itrx}$")
if (${testname} MATCHES "${_itr}")
@ -88,6 +96,11 @@ macro(findexpr found testname listname rsublabel)
set(${found} ${_found})
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)
set(sublabel "")
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 (NOT "${sublabel}" STREQUAL "")
list(APPEND ${listlabels} ${sublabel})
string(TOUPPER "${sublabel}_" tmpprefix)
join(sublabel "." tmpprefixx)
string(TOUPPER "${tmpprefixx}_" tmpprefix)
else()
set(tmpprefix "")
endif()
@ -165,12 +179,15 @@ macro(loadTestList filename resList)
if(_newl)
string(REGEX REPLACE "(\\/|\\||\\(|\\))" " " _vxx ${_newl})
string(REGEX MATCHALL " ([a-z][a-z](_[A-Z][A-Z])?) " _vx ${_vxx})
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()
if (_newl MATCHES "^Sublabel:")
string(REGEX REPLACE "^Sublabel:[ \t]*" "" _newlabels ${_newl})
string(REGEX MATCHALL "([a-zA-Z]+)" _labels ${_newlabels})
foreach(labname ${_labels})
if (NOT labname STREQUAL "RESET")
list(REMOVE_ITEM mylabels ${labname})
list(APPEND mylabels ${labname})
endif()
endforeach()
set(sublabel ${_newl})
endif()
if(_vx)