Coverage report
coverage_report ¶
A report that re-organizes a cobertura.xml by INF.
SplitCommaAction ¶
A Custom action similar to append, but will split the input string on commas first.
__call__ ¶
__call__(
parser: ArgumentParser,
namespace: Namespace,
values: str | Sequence[str],
option_string: Optional[str] = None,
) -> None
Command entry.
CoverageReport ¶
A report that re-organizes a cobertura.xml by INF.
This report will supports two modes, by-package and by-platform. By-package will only include coverage data for files in the specified edk2 packages. By-platform will only include coverage data for files used to build the specified platform dsc.
report_info ¶
report_info() -> Tuple[str, str]
Returns the report standard information.
Returns:
Type | Description |
---|---|
(str, str)
|
A tuple of (name, description) |
add_cli_options ¶
add_cli_options(parserobj: ArgumentParser) -> None
Configure command line arguments for this report.
run_by_platform ¶
run_by_platform(
session: Session, package_list: list
) -> None
Runs the report, only adding coverage data for source files used to build the platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Session
|
The session associated with the database |
required |
package_list |
list
|
The list of packages to filter the results by |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the report was successful, False otherwise. |
run_by_package ¶
run_by_package(
session: Session, package_list: list
) -> bool
Runs the report, only adding coverage data for source files in the specified packages.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Session
|
The session associated with the database |
required |
package_list |
list
|
The list of packages to filter the results by |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the report was successful, False otherwise. |
build_source_coverage_dictionary ¶
build_source_coverage_dictionary(
xml_path: str, package_list: list
) -> dict
Builds a dictionary of source files and their coverage data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xml_path |
str
|
path to xml file storing coverage data |
required |
package_list |
list
|
list of packages that a file must be in to be included in the report |
required |
Returns:
Type | Description |
---|---|
dict
|
dict[str, ET.Element]: A dictionary of source files and their coverage data. |
build_inf_source_dictionary ¶
build_inf_source_dictionary(
data: dict, package_list: list
) -> dict
Builds a dictionary of INFs and the source files they use.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
dict
|
The data to build the dictionary from |
required |
package_list |
list
|
The packages to filter the results by |
required |
Returns:
Type | Description |
---|---|
dict
|
dict[str, list[str]]: A dictionary of INFs and the source files they use. |
build_report ¶
build_report(
session: Session,
env_id: int,
source_coverage_dict: dict,
inf_source_dict: dict,
) -> None
Builds the report.
For each source file in each INF in the inf_source dictionary, look to see if there is coverage data for it in the source_coverage dictionary. If it exists, insert it into the new report. Writes the final report to the specified file.
update_excluded_files ¶
update_excluded_files() -> None
Replaces any files in the exclude list with their contents.
create_source_xml ¶
create_source_xml(
source_path: str, edk2path: Edk2Path
) -> ET
Parses the source file and creates a coverage 'lines' xml element for it.
flatten_report ¶
flatten_report(
root: ET.Element, edk2path: Edk2Path
) -> ET.Element
Flattens the report to only source files, removing the INF layer and duplicate source files.