flowbber.plugins.sources.lcov

Lcov

This source calls lcov on a specified directory to generate a tracefile or loads one directly, and process it with lcov_cobertura to create a standard Cobertura XML file, which in turn is then parsed using the flowbber Cobertura source.

Note

This source requires the lcov executable to be available in your system to run.

Data collected:

{
    "files": {
        "my_source_code.c": {
            "total_statements": 40,
            "total_misses": 20,
            "branch_rate": 0.5,
            "total_hits": 8,
            "line_rate": 0.5
        },
        "another_source.c": {
            "total_statements": 40,
            "total_misses": 40,
            "branch_rate": 0.5,
            "total_hits": 8,
            "line_rate": 0.0
        }
    },
    "total": {
        "total_statements": 80,
        "total_misses": 20,
        "line_rate": 0.75
    },
    "tracefile": "<path-to-tracefile.info>"
}

Dependencies:

pip3 install flowbber[lcov]

Usage:

[[sources]]
type = "lcov"
id = "..."

    [sources.config]
    source = "{pipeline.dir}"
    rc_overrides = ["lcov_branch_coverage=1"]
    remove = ["*hello2*"]
    remove_files = [
        "/file/with/remove/patterns",
        ".removepatterns"
    ]
    extract = ["*hello1*"]
    extract_files = [
        "/file/with/extract/patterns",
        ".extractpatterns"
    ]
    derive_func_data = false
{
    "sources": [
        {
            "type": "lcov",
            "id": "...",
            "config": {
                "source": "{pipeline.dir}",
                "rc_overrides": ["lcov_branch_coverage=1"],
                "remove": ["*hello2*"]
                "remove_files": [
                    "/file/with/remove/patterns",
                    ".removepatterns"
                ],
                "extract": ["*hello1*"],
                "extract_files": [
                    "/file/with/extract/patterns",
                    ".extractpatterns"
                ],
                "derive_func_data": false,
            }
        }
    ]
}

source

Path to the directory containing gcov’s .gcda files or path to a tracefile .info file.

  • Default: N/A

  • Optional: False

  • Schema:

    {
        'type': 'string',
        'empty': False
    }
    
  • Secret: False

rc_overrides

Override lcov configuration file settings.

Elements should have the form SETTING=VALUE.

  • Default: []

  • Optional: False

  • Schema:

    {
        'type': 'list',
        'schema': {
            'type': 'string',
            'empty': False
        },
    }
    
  • Secret: False

remove

List of patterns of files to remove from coverage computation.

Patterns will be interpreted as shell wild‐card patterns.

  • Default: []

  • Optional: True

  • Schema:

    {
        'type': 'list',
        'schema': {
            'type': 'string',
            'empty': False,
        },
    }
    
  • Secret: False

remove_files

List of paths to files containing patterns of files to remove from coverage computation.

Patterns will be interpreted as shell wild‐card patterns.

All unique patterns parsed from these files will be added to the ones defined in the remove configuration option.

  • Default: []

  • Optional: True

  • Schema:

    {
        'type': 'list',
        'schema': {
            'type': 'string',
            'empty': False,
        },
    }
    
  • Secret: False

extract

List of patterns of files to extract for coverage computation.

Use this option if you want to extract coverage data for only a particular set of files from a tracefile. Patterns will be interpreted as shell wild‐card patterns.

  • Default: []

  • Optional: True

  • Schema:

    {
        'type': 'list',
        'schema': {
            'type': 'string',
            'empty': False,
        },
    }
    
  • Secret: False

extract_files

List of paths to files containing patterns of files to extract for coverage computation.

Patterns will be interpreted as shell wild‐card patterns.

All unique patterns parsed from these files will be added to the ones defined in the extract configuration option.

  • Default: []

  • Optional: True

  • Schema:

    {
        'type': 'list',
        'schema': {
            'type': 'string',
            'empty': False,
        },
    }
    
  • Secret: False

derive_func_data

Allow lcov to calculate function coverage data from line coverage data.

If True then the --derive-func-data option is used on the lcov commands. If False then the option is not used.

This option is used to collect function coverage data, even when this data is not provided by the installed gcov tool. Instead, lcov will use line coverage data and information about which lines belong to a function to derive function coverage.

  • Default: False

  • Optional: True

  • Schema:

    schema={
        'type': 'boolean',
    },
    
  • Secret: False

Classes

  • LcovSource: Main base class to implement a Source.
class flowbber.plugins.sources.lcov.LcovSource(index, type_, id_, optional=False, timeout=None, config=None)

Inheritance

Inheritance diagram of LcovSource