summaryrefslogtreecommitdiff
path: root/scripts/code_cov_parse_info
AgeCommit message (Collapse)Author
2022-06-15code_cov_parse_info: output filters at the html reportMauro Carvalho Chehab
Add a line after the code coverage summary printing the filters that were used to produce the results, if any. This is important specially when multiple filters could be used to produce different reports. Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-14code_cov_parse_info: add support for generating html reportsMauro Carvalho Chehab
While lcov has already its own report generator, it is interesting to be able to deal with multiple files exposing each input in separate. So, add new command line parameters to allow it to generate html reports. Also add some command lines to setup html title, add a css file and include a prolog/epilog at the html body. The title option can also be useful to rename the titles when merging multiple info files. Acked-by: Andrzej Hajda <andrzej.hajda@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-14code_cov_parse_info: add support for exclude filtersMauro Carvalho Chehab
It is interesting to have support not only for including, but also for excluding functions and files. Also, it is trivial to have support for it. When either one or both source/function filters are enabled, it will print at the console the regular expressions that are applied to functions and sources (if any), e. g.: $ cat << END >f1 +i915 gem - display -selftest END $ cat << END >f2 -/selftests END $ code_cov_parse_info dg1.info dg2.info --func-filters f1 --source-filters f2 --stat lines......: 72.1% (176 of 244 lines) functions..: 77.3% (17 of 22 functions) branches...: 50.0% (68 of 136 branches) Filters......: function regex (not match: m`display` m`selftest` and match: m`i915` m`gem`), source regex (match: m`/selftest`) and ignored source files where none of its code ran. Source files.: 0.99% (7 of 710 total), 77.78% (7 of 9 filtered) Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-14code_cov_parse_info: fix --show-lines logicMauro Carvalho Chehab
print_code_coverage function needs to first read the number of lines and then simplify the $file by removing its prefix. Without that, it ends trying to access an uninitiated value, leading to warnings and not doing what's expected. While here, also check if the ln data is valid, just in case the .info file might have some FN field(s) missing. Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-14code_cov_parse_info: fix error handling when opening filesMauro Carvalho Chehab
While on bash scripts we use "||" for error handling, perl accepts it, but it has a higher priority, thus would require to use parenthesis before that. That causes it to print a warning when the open fail while reading filter files, instead of the original intent of finishing and reporting an error. So, let's use "or" instead. Reviewed-by: Ch Sai Gowtham <sai.gowtham.ch@intel.com> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-14scripts/code_cov_parse_info: better handle test nameMauro Carvalho Chehab
The TN field generated by standard lcov is weird: it keeps repeating the TN field from time to time. At genhtml, it seems that only the first one is used. As we're using TN to indicate the test name, preserve all different test names at the output file. Also, printing such names doesn't really makes sense when --print-used and --print-unused command line options are used, and printing a list of 100+ names won't make much sense. So, just remove printing the test names. Reviewed-by: Ch Sai Gowtham <sai.gowtham.ch@intel.com> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-04-14scripts/code_cov_parse_info: add a tool to parse code coverage info filesMauro Carvalho Chehab
The code coverage info files provide useful information about what functions were called and how many times. It can also contain data that it is not useful for the code coverage, like calls to non-DRM related Kernel APIs. Add a tool that helps filtering out non-DRM files and prints what functions were called. Both the stats, prints and output files are affected by the filters: $ code_cov_parse_info --stat total.info lines......: 40.8% (71989 of 176442 lines) functions..: 50.2% (5975 of 11909 functions) branches...: 28.7% (35006 of 121893 branches) Source files: 744 $ code_cov_parse_info total.info --stat --only-drm lines......: 40.3% (70244 of 174170 lines) functions..: 50.8% (5835 of 11491 functions) branches...: 28.4% (33096 of 116707 branches) Ignored......: non-drm headers. Source files.: 78.36% (583 of 744 total) $ code_cov_parse_info total.info --stat --only-drm --ignore-unused -o o.info lines......: 47.9% (70244 of 146752 lines) functions..: 50.8% (5835 of 11491 functions) branches...: 32.8% (33096 of 100900 branches) Ignored......: non-drm headers and source files where none of its code ran. Source files.: 58.87% (438 of 744 total), 75.13% (438 of 583 filtered) $ code_cov_parse_info --stat o.info lines......: 47.9% (70244 of 146752 lines) functions..: 59.8% (5835 of 9763 functions) branches...: 32.8% (33096 of 100900 branches) Source files: 438 Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>