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