add auto-naming of unit test suites

pull/8153/head
Lari-Matias Orjala 2018-09-17 15:37:11 +03:00
parent c356f1f9d4
commit 3e7ee6c4d1
8 changed files with 12 additions and 27 deletions

View File

@ -147,11 +147,17 @@ foreach(testfile ${unittest-file-list})
# Get source files
include("${testfile}")
if(TEST_SUITE_NAME)
set(TEST_SUITES ${TEST_SUITES} ${TEST_SUITE_NAME})
else()
message(FATAL_ERROR "No TEST_SUITE_NAME found in test file. Add it to ${testfile}.")
endif()
get_filename_component(TEST_SUITE_DIR ${testfile} DIRECTORY)
file(RELATIVE_PATH
TEST_SUITE_NAME # output
${PROJECT_SOURCE_DIR} # root
${TEST_SUITE_DIR} #abs dirpath
)
string(REGEX REPLACE "/|\\\\" "-" TEST_SUITE_NAME ${TEST_SUITE_NAME})
set(TEST_SUITES ${TEST_SUITES} ${TEST_SUITE_NAME})
set(LIBS_TO_BE_LINKED gmock_main)
@ -178,7 +184,7 @@ foreach(testfile ${unittest-file-list})
# Link the executable with the libraries.
target_link_libraries(${TEST_SUITE_NAME} ${LIBS_TO_BE_LINKED})
add_test(NAME "${TEST_SUITE_NAME}UnitTests" COMMAND ${TEST_SUITE_NAME})
add_test(NAME "${TEST_SUITE_NAME}" COMMAND ${TEST_SUITE_NAME})
# Append test build directory to list
list(APPEND BUILD_DIRECTORIES "./CMakeFiles/${TEST_SUITE_NAME}.dir")

View File

@ -3,9 +3,6 @@
# UNIT TESTS
####################
# Unit test suite name
set(TEST_SUITE_NAME "cellular-framework-AT-AT_CellularBase")
# Add test specific include paths
set(unittest-includes ${unittest-includes}
features/cellular/framework/AT/AT_CellularBase

View File

@ -3,9 +3,6 @@
# UNIT TESTS
####################
# Unit test suite name
set(TEST_SUITE_NAME "cellular-framework-common-util")
# Add test specific include paths
set(unittest-includes ${unittest-includes}
features/cellular/framework/common/util

View File

@ -3,9 +3,6 @@
# UNIT TESTS
####################
# Unit test suite name
set(TEST_SUITE_NAME "features-netsocket-InternetSocket")
set(unittest-sources
../features/netsocket/SocketAddress.cpp
../features/netsocket/NetworkStack.cpp

View File

@ -3,9 +3,6 @@
# UNIT TESTS
####################
# Unit test suite name
set(TEST_SUITE_NAME "features-netsocket-NetworkInterface")
# Source files
set(unittest-sources
../features/netsocket/NetworkInterface.cpp

View File

@ -3,9 +3,6 @@
# UNIT TESTS
####################
# Unit test suite name
set(TEST_SUITE_NAME "features-netsocket-TCPSocket")
set(unittest-sources
../features/netsocket/SocketAddress.cpp
../features/netsocket/InternetSocket.cpp

View File

@ -3,9 +3,6 @@
# UNIT TESTS
####################
# Unit test suite name
set(TEST_SUITE_NAME "features-netsocket-UDPSocket")
set(unittest-sources
../features/netsocket/SocketAddress.cpp
../features/netsocket/NetworkStack.cpp

View File

@ -3,9 +3,6 @@
# UNIT TESTS
####################
# Unit test suite name
set(TEST_SUITE_NAME "platform-CircularBuffer")
set(unittest-sources
)