blob: 3e56d8388c789b7dabdae531b1ce723d269fdf15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#-------------------------------------------------------------------------------
# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.16)
include(../../deployment.cmake REQUIRED)
#-------------------------------------------------------------------------------
# The CMakeLists.txt for building the component-test deployment for linux-pc
#
# Used for building and running component level tests in a native PC enviroment.
# Tests can be run by running the built executable called "component-test"
#-------------------------------------------------------------------------------
include(${TS_ROOT}/environments/linux-pc/env.cmake)
project(trusted-services LANGUAGES CXX C)
# Preparing firmware-test-build by including it
include(${TS_ROOT}/external/firmware_test_builder/FirmwareTestBuilder.cmake)
include(CTest)
include(UnitTest)
set(COVERAGE FALSE CACHE BOOL "Enable code coverage measurement")
set(UNIT_TEST_PROJECT_PATH ${TS_ROOT} CACHE PATH "Path of the project directory")
set(CMAKE_CXX_STANDARD 11)
unit_test_init_cpputest()
if (COVERAGE)
include(Coverage)
set(COVERAGE_FILE "coverage.info")
set(COMPONENT_TEST_COVERAGE_FILE "component-test-coverage.info" CACHE PATH "Path of coverage info file")
set(COMPONENT_TEST_COVERAGE_REPORT_DIR "${CMAKE_CURRENT_BINARY_DIR}/component-test-coverage-report" CACHE PATH "Directory of coverage report")
# Collecting coverage
coverage_generate(
NAME "Component test"
SOURCE_DIR ${TS_ROOT}
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}
OUTPUT_FILE ${COVERAGE_FILE}
)
# Filtering project file coverage
coverage_filter(
INPUT_FILE ${COVERAGE_FILE}
OUTPUT_FILE ${COMPONENT_TEST_COVERAGE_FILE}
INCLUDE_DIRECTORY ${UNIT_TEST_PROJECT_PATH}/components
)
# Coverage report
coverage_generate_report(
INPUT_FILE ${COMPONENT_TEST_COVERAGE_FILE}
OUTPUT_DIRECTORY ${COMPONENT_TEST_COVERAGE_REPORT_DIR}
)
endif()
unit_test_add_suite(
NAME component-test
)
target_include_directories(component-test PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
#-------------------------------------------------------------------------------
# Extend with components that are common across all deployments of
# component-test
#
#-------------------------------------------------------------------------------
include(../component-test.cmake REQUIRED)
|