Commit Graph

2 Commits

Author SHA1 Message Date
Eliran Sinvani
11eb9f5bb2 coreage_utils.py: make regular expression lazy in html-fixup
The html-fixup procedure was created because of a bug in genhtml (`man
genhtml` for details about what genhtml is). The bug is that genhtml
doesn't account for file names that contains illegal  url characters (ref:
https://stackoverflow.com/a/1547940/2669716). html-fixup converts those
characters to the %<octet> notation (i.e space character becomes %20
etc..). However, the regular expression used to detect links was eager,
which didn't account for multiple links in the same line. This was
discovered during browsing one of the report and noticing that the links
that are meant to alternate between code view and function view of a
source got scrambled and unusable after html-fixup.
This change makes the regex that is used to detect links lazy so it can
handle multiple links in the same line in an html file correctly.

Signed-off-by: Eliran Sinvani <eliransin@scylladb.com>
2024-01-25 09:30:42 +02:00
Eliran Sinvani
00a55abdd6 code coverage: Add libraries for coverage handling
Coverage handling is divided into 3 steps:
1. Generation of  profiling data from a run of an instrumented file
   (which this patch doesn't cover)
2. Processing of profiling data, which involves indexing the profile and
   producing the data in some format that can be manipulated and
   unified.
3. Generate some reporting based on this data.

The following patch is aiming to deal with the last two steps by providing a
cli and a library for this end.
This patch adds two libraries:
1. `coverage_utils.py` which is a library for manipulating coverage
   data, it also contains a cli for the (assumed) most common operations
   that are needed in order to eventually generate coverage reporting.
2. `lcov_utils.py` - which is a library to deal with lcov format data,
   which is a textual form containing a source dependant coverage data.
   An example of such manipulation can be `coverage diff` operation
   which produces a set like difference operation. cov_a - cov_b = diff
   where diff is an lcov formated file containing coverage data for code
   cov_a that is not covered at all in cov_b.

The libraries and cli main goal is to provide a unified way to handle
coverage data in a way that can be easily scriptable and extensible.

This will pave the way for automating the coverage reporting and
processing in test.py and in jenkins piplines (for example to also
process dtest or sct coverage reporting)

Signed-off-by: Eliran Sinvani <eliransin@scylladb.com>
2024-01-18 11:11:34 +02:00