Closed
Description
In Cairo coverage, we use compilator mappings in the form of: Sierra ID -> list of details, where each detail is a triple consisting of:
- Path to file
- Line in file
- Function name
We want to focus on the coverage of functions that belong to the user project. However, the user should also have the option to filter out test functions in their project, as these might disturb the true line coverage statistics.
Sierra JSON Files
The structure of the *.sierra.json files is as follows:
{
"version": 1,
"type_declarations": [],
"libfunc_declarations": [],
"statements": [],
"funcs": [],
"debug_info": {
"type_names": [],
"libfunc_names": [],
"user_func_names": [],
"annotations": [],
"executables": {
"snforge_internal_test_executable": [
{
"id": 4,
"debug_name": "some_debug_name"
}
]
}
}
}
In the debug_info.executables.snforge_internal_test_executable
section, entries point to functions marked with #[test]
. Thanks to this, we know the debug names of the functions marked with #[test]
.
High-level Algorithm
- Extract function names marked with
#[test]
from the*.sierra.json
files. - Analyze entries of Sierra ID -> list of [(path to file, line in file, function name)].
- Check if the
function_name
is not in the list of test functions. - Filter out entries that do not meet these criteria.
This will not work on functions in #[cfg(test)]
that are not marked #[test]
this should be fixed here .
Metadata
Metadata
Assignees
Labels
No labels