| 1 |
include_directories( |
| 2 |
${CMAKE_SOURCE_DIR}/src |
| 3 |
${GMOCK_INCLUDE_DIRS} |
| 4 |
) |
| 5 |
|
| 6 |
add_definitions(-DENABLE_LEGACY=1) |
| 7 |
add_definitions(-DTEST_DEFAULT_DIR="${TEST_DATA_DIR}") |
| 8 |
add_definitions(-DTEST_DEVICE_DIR="${TEST_DATA_DIR}/devices") |
| 9 |
|
| 10 |
macro(declare_test test testname) |
| 11 |
add_executable(${testname} ${testname}.cpp) |
| 12 |
target_link_libraries(${testname} |
| 13 |
${TARGET} |
| 14 |
|
| 15 |
${GTEST_LIBRARIES} |
| 16 |
${GTEST_BOTH_LIBRARIES} |
| 17 |
${GMOCK_LIBRARIES} |
| 18 |
) |
| 19 |
|
| 20 |
if(TEST_XML_OUTPUT) |
| 21 |
set(TEST_ARGS -p -xunitxml -p -o -p ${testname}.xml) |
| 22 |
else() |
| 23 |
set(TEST_ARGS "") |
| 24 |
endif() |
| 25 |
|
| 26 |
add_test(${test} ${testname}) |
| 27 |
#set_tests_properties(${testname} PROPERTIES |
| 28 |
# TIMEOUT ${CTEST_TESTING_TIMEOUT} |
| 29 |
# ENVIRONMENT "QT_QPA_PLATFORM=minimal") |
| 30 |
|
| 31 |
set(TESTS ${TESTS} ${testname}) |
| 32 |
endmacro(declare_test testname) |
| 33 |
|
| 34 |
declare_test(TestConfig tst_config) |
| 35 |
declare_test(TestDeviceinfo tst_deviceinfo) |
| 36 |
declare_test(TestUtils tst_utils) |
| 37 |
|
| 38 |
find_package(CoverageReport) |
| 39 |
enable_coverage_report( |
| 40 |
TARGETS |
| 41 |
deviceinfo |
| 42 |
FILTER |
| 43 |
${CMAKE_SOURCE_DIR}/tests/* |
| 44 |
${CMAKE_BINARY_DIR}/* |
| 45 |
TESTS |
| 46 |
${TESTS} |
| 47 |
) |