Imre Kis | d4ed659 | 2021-01-14 21:10:51 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | cmake_minimum_required(VERSION 3.16) |
| 8 | include(../../deployment.cmake REQUIRED) |
| 9 | |
| 10 | project(libsp-unit-tests LANGUAGES CXX C) |
| 11 | |
| 12 | # Preparing firmware-test-build by including it |
| 13 | include(${TS_ROOT}/external/firmware_test_builder/FirmwareTestBuilder.cmake) |
| 14 | |
| 15 | include(CTest) |
| 16 | include(UnitTest) |
| 17 | |
| 18 | set(COVERAGE FALSE CACHE BOOL "Enable code coverage measurement") |
| 19 | set(UNIT_TEST_PROJECT_PATH ${TS_ROOT} CACHE PATH "Path of the project directory") |
| 20 | set(CMAKE_CXX_STANDARD 11) |
| 21 | |
| 22 | unit_test_init_cpputest() |
| 23 | |
| 24 | if (COVERAGE) |
| 25 | include(Coverage) |
| 26 | |
| 27 | set(COVERAGE_FILE "coverage.info") |
| 28 | set(LIBSP_COVERAGE_FILE "libsp-coverage.info" CACHE PATH "Path of coverage info file") |
| 29 | set(LIBSP_COVERAGE_REPORT_DIR "${CMAKE_CURRENT_BINARY_DIR}/libsp-coverage-report" CACHE PATH "Directory of coverage report") |
| 30 | |
| 31 | # Collecting coverage |
| 32 | coverage_generate( |
| 33 | NAME "libsp unit test" |
| 34 | SOURCE_DIR ${TS_ROOT} |
| 35 | BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} |
| 36 | OUTPUT_FILE ${COVERAGE_FILE} |
| 37 | ) |
| 38 | |
| 39 | # Filtering project file coverage |
| 40 | coverage_filter( |
| 41 | INPUT_FILE ${COVERAGE_FILE} |
| 42 | OUTPUT_FILE ${LIBSP_COVERAGE_FILE} |
| 43 | INCLUDE_DIRECTORY ${UNIT_TEST_PROJECT_PATH}/components/messaging/ffa/libsp |
| 44 | ) |
| 45 | |
| 46 | # Coverage report |
| 47 | coverage_generate_report( |
| 48 | INPUT_FILE ${LIBSP_COVERAGE_FILE} |
| 49 | OUTPUT_DIRECTORY ${LIBSP_COVERAGE_REPORT_DIR} |
| 50 | ) |
| 51 | endif() |
| 52 | |
| 53 | # Including test suite descriptions |
| 54 | include(${TS_ROOT}/components/messaging/ffa/libsp/tests.cmake) |