Selective Code Coverage via Source Annotations
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Traditional code coverage tools are inefficient and resource-intensive, as they attempt to cover all software code, leading to unnecessary complexity and overhead, and lack a simple mechanism for selective code coverage analysis, particularly in large software systems like operating system kernels.
Innovation Solution
A method and apparatus for selective code coverage that annotates specific code locations, allowing for targeted code coverage analysis, where only annotated code is monitored, and a compiler compiles the code with minimal overhead, enabling efficient collection and reporting of code coverage information without additional tool support.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If traditional code coverage tools attempt to cover every portion of target software, then comprehensive code coverage is achieved, but system resources and engineering resources are wasted on uninterested or uncritical software code
Solution Approach 1:
The patent segments the code coverage analysis by dividing the software codebase into critical and non-critical portions. It uses compiler directives to annotate specific code sections that require coverage monitoring, while excluding other sections. This segmentation allows the system to focus resources only on critical code paths, achieving precise measurement of important code coverage without wasting resources on comprehensive coverage of all code.
2Measurement precision
If existing code coverage tools monitor each instruction execution on target software, then code coverage information is collected, but the software development environment becomes more complex
Solution Approach 1:
The patent merges the code coverage monitoring functionality directly into the standard compiler by extending the compiler with coverage analysis capabilities. Instead of using separate external tools that add complexity to the development environment, the coverage monitoring is integrated into the compilation process itself. The compiler reads annotations from source code, generates appropriate monitoring code during compilation, and produces executables with built-in coverage tracking, thereby collecting code coverage information without requiring additional complex tooling.
3Measurement precision
If existing code coverage tools are used to cover entire software body, then comprehensive coverage is achieved, but manual removal of selected portions becomes cumbersome and laborious
Solution Approach 1:
The patent applies preliminary action by having developers annotate critical code sections in advance using compiler directives before compilation. These annotations are embedded in the source code itself, specifying which portions require coverage monitoring. The compiler then automatically processes these pre-marked sections during compilation, generating the appropriate monitoring code. This preliminary annotation approach eliminates the need for cumbersome post-compilation manual removal or configuration of coverage sections, making selective code coverage straightforward and easy to operate.
Data Source
AI summary
Methods and apparatuses that collect code coverage information for selected code locations when executing executable code are described. Source code in one or more files may be annotated at the selected code locations. The executable code may be compiled from the annotated source code using standard compilers. The code coverage information may be collected into a run time data store accessible by other applications. In response to receiving a code coverage request, the code coverage information can be retrieved from the data store to compare with annotations identified from the source code. A code coverage report can be generated to indicate whether one or more of the selected code locations are not covered when executing the executable code.


