blob: 76f8f3f5bfe71c4b8cdd566eb82ad739d7a63e34 [file] [log] [blame]
Imre Kis1d2fbdd2019-12-13 11:42:08 +01001Trusted Firmware-A Unit Test Documentation
2==========================================
Gyorgy Szing05ece0e2019-10-08 12:56:59 +02003
4.. toctree::
Imre Kis1d2fbdd2019-12-13 11:42:08 +01005 :maxdepth: 1
6 :hidden:
7 :numbered:
8
9 Home<self>
10 user_guide
11 implementing_tests
12 components/index
Gyorgy Szing05ece0e2019-10-08 12:56:59 +020013
14 contributing
Imre Kis1d2fbdd2019-12-13 11:42:08 +010015 glossary
16 license
17
18This repository contains the unit testing system and the unit tests of the
19`Trusted Firmware-A`_ (TF-A) project. These tests are meant to run on host
20machine and used to cover platform independent code on the unit test level. In
21this case a unit is considered to be a C function or couple related functions.
22Each unit test suite compiles into a binary which can be run and debugged as any
23ordinary executable.
24
25The system uses CppUTest as unit testing framework. The tests are written in C++
26in order to be able to use CppUTests' all useful features like the automatic
27collection of test cases and the CppUMock mocking system.
28
29Separating dependencies apart from the code under test is a crutial step in unit
30testing systems. In many cases this can be easily done by linking mocked
31functions to the tested code but sometimes it's difficult like when the code
32under test and its dependencies are in the same compilation unit. For separating
33the code under test from its dependencies a tool called c-picker can be used. It
34can pick pieces of code (functions, variables, etc.) based on descriptor files.
35
36The build system is based on CMake. The repository contains CMake modules for
37defining unit test suites. It also invokes c-picker if a descriptor file is
38listed among the test sources. CMake has a built in test driver system called
39ctest. It runs all the test binaries and produces an well structured output.
40Test filtering and parallel test run is also available.
41
42For measuring unit test coverage lcov is utilized. The coverage of c-picker
43generated sources is mapped to the original sources files. Coverage currently
44only works with GCC.
45
46As a next step start with reading the :ref:`User guide` and the
47:ref:`Implementing tests` section of this manual. For detailed description of
48the components check the :ref:`Component user manuals` section.
49
Gyorgy Szing05ece0e2019-10-08 12:56:59 +020050
51--------------
52
Imre Kis1d2fbdd2019-12-13 11:42:08 +010053*Copyright (c) 2019, Arm Limited. All rights reserved.*
Gyorgy Szing05ece0e2019-10-08 12:56:59 +020054
Imre Kis1d2fbdd2019-12-13 11:42:08 +010055.. _`Trusted Firmware-A`: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about