-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add processing of code coverage for optee core #4192
base: master
Are you sure you want to change the base?
Commits on Nov 2, 2020
-
core: add configuration flags for gcov
This patch adds the flags to configure the use of gcov: - CFG_CORE_GCOV_SUPPORT: enable the coverage for the core - CFG_TA_GCOV_SUPPORT: enable the coverage for TAs If any of them is enabled, CFG_GCOV_SUPPORT is enabled These flags are exported to the devkit. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Configuration menu - View commit details
-
Copy full SHA for cb8cd11 - Browse repository at this point
Copy the full SHA cb8cd11View commit details -
compil: Fix link error TEE_RAM_VA_SIZE is too small
For imx 6 qnd 7 targets, the build fails because TEE_RAM_VA_SIZE is too small. This patch increase it from 512ko to 2 Mo when coverage is enabled. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Configuration menu - View commit details
-
Copy full SHA for 89e521c - Browse repository at this point
Copy the full SHA 89e521cView commit details -
libgcov: Add library adding the gcov support
The code coverage is a metric measuring the lines of code executed in a code base during execution. If the code coverage is generated after a test suite is ran, it will give the coverage of code tested by the test suite. It gives the possibility to identify the code which is not tested. The gcov code coverage is supported by different compiler: - GCC (gcc.gnu.org/onlinedocs/gcc/Gcov.html) - clang compiler (clang.llvm.org/docs/SourceBasedCodeCoverage.html) It allows to analyze which part of the code is executed. The interface with a specific implementation of gcov is defined usign the structure gcov_impl_t. The library implements the symbol required for gcov: - __gcov_init: called by each coverage unit - __gcov_merge_add - __gcov_exit The calls to these symbols are redirected to the implementation for the compiler used. The library role is to transform the coverage data in program memory to a valid gcov data file. For this it interacts with: - user/TA: Control (Reset or Dump) the coverage data - Function to store data: Send the data to it for storage in REE FS In order to retrieve the coverage (*.gcda) for a specific UC, it is recommended to do the following actions: - clear the coverage - perform the UC - save the coverage Note: The core and the TAs are linked against different instances of the libgcov. The libgcov of the core can be controlled by the gcov PTA. The TA instances are controlled calling the libgcov API. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Configuration menu - View commit details
-
Copy full SHA for ad40ae8 - Browse repository at this point
Copy the full SHA ad40ae8View commit details -
libgcov: Add implementation of gcov for GCC
The compiler GCC implements gcov code coverage and this patch adds the support to handle the structure in memory generated by the compiler. It also handles the transformation of the structure in memory into gcov data files. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Configuration menu - View commit details
-
Copy full SHA for ce426d3 - Browse repository at this point
Copy the full SHA ce426d3View commit details -
core: Add writer of coverage data to REE FS
The coverage data are generated during execution, in order to exploit it, the data can be stored to REE FS in clear text which is done by the writer. The writer receives the data to store and call the dedicated RPC to instruct the TEE client to store it in REE FS. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Configuration menu - View commit details
-
Copy full SHA for db065b3 - Browse repository at this point
Copy the full SHA db065b3View commit details -
The PTA has two main purposes: - Control the code coverage of the core: - PTA_CMD_GCOV_GET_VERSION - PTA_CMD_GCOV_CORE_RESET - PTA_CMD_GCOV_CORE_DUMP_ALL - Write code coverage data from a TA (called by libgcov) - PTA_CMD_GCOV_DUMP Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Configuration menu - View commit details
-
Copy full SHA for e5d442f - Browse repository at this point
Copy the full SHA e5d442fView commit details -
core: Add support for code coverage compilation
The code coverage is performed at runtime by keeping in memory structures holding the releveant data: In order to generate the code coverage, two steps are required: - Instruct the compiler to generate coverage information structure and functions to initialize them: flag --coverage. - Call the constructors added to initialize the coverage information and register them to the libgcov (modification of boot.c) When an object file (.o) is created with code coverage support, a note (.gcno) file is created with it. The note file contains informations used when creating the code coverage report. The support of code coverage in compiled code increases its size (~15%) and the compilation time (~25%). Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Configuration menu - View commit details
-
Copy full SHA for 92afa01 - Browse repository at this point
Copy the full SHA 92afa01View commit details -
coverage.py: Add script to process code coverage
This script ease the generation of code coverage report. A report is based on a codebase, note files (generated at compilation) and data files (generated at runtime). The report is generated using lcov and present the code coverage as a percentage of lines executed compared to the total number of lines in the codebase. The script will copy all the note and data files in a temporary directory allowing to reuse the generated artifact and checks that the note and data file are correctly organised (the files must be in the same directory). The script also allow to generate an html output using genhtml and to view it. Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Configuration menu - View commit details
-
Copy full SHA for 08d97f1 - Browse repository at this point
Copy the full SHA 08d97f1View commit details