Merge pull request #468 from akva2/strip_test_prefix

added: strip test_ prefix from tests added with opm_add_test
This commit is contained in:
Arne Morten Kvarving 2018-08-03 12:08:15 +02:00 committed by GitHub
commit ee6fab7395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,6 +228,13 @@ macro(opm_add_test TestName)
set(CURTEST_EXE_NAME ${TestName})
endif()
# Strip test_ prefix from name
if ("${TestName}" MATCHES "^test_([^/]*)$")
string (REGEX REPLACE "^test_([^/]*)$" "\\1" _FANCY "${TestName}")
else()
set(_FANCY ${TestName})
endif()
# try to auto-detect the name of the source file if SOURCES are not
# explicitly specified.
if (NOT CURTEST_SOURCES)
@ -331,7 +338,7 @@ macro(opm_add_test TestName)
endif()
endif()
add_test(NAME ${TestName}
add_test(NAME ${_FANCY}
WORKING_DIRECTORY "${CURTEST_WORKING_DIRECTORY}"
COMMAND ${CURTEST_COMMAND})
@ -359,7 +366,7 @@ macro(opm_add_test TestName)
# CDash dashboard. it this is removed, the test is just silently
# ignored.
if (NOT CURTEST_ONLY_COMPILE AND ADD_DISABLED_CTESTS)
add_test(${TestName} skip_test_dummy)
add_test(${_FANCY} skip_test_dummy)
endif()
endif()
endmacro()