-
Notifications
You must be signed in to change notification settings - Fork 37
fobos intrinsic rules gcov analyzer
This intrinsic rule parses (by means of a parser builtin into FoBiS.py) all .gcov files found into the root directory where FoBiS.py is executed and produces a pretty markdown file (for each .gcov file) containing a curated report of the coverage analysis. Obviously, the gcov tool must be executed before running this intrinsic rule. Let us consider an example. The tree of our example looks like
src
├── cumbersome.f90
└── nested-1
├── first_dep.f90
└── nested-2
└── second_dep.incIn order to obtain the coverage reports we must follow the steps below
The project must be compiled with the coverage flags:
FoBiS.py build -compiler gnu -coverage --target src/cumbersome.f90 -o cumbersomeThis instruments the code with coverage tools for analysing the sources.
The instrumented code must be run in order to collect coverage data.
./cumbersomeRunning the gcov tool will produce the .gcov files
gcov -o obj/ src/cumbersome.f90 src/nested-1/first_dep.f90This generates two files into the root directory:
cumbersome.f90.gcov-
first_dep.f90.gcovYou can place these files everywhere into the root directory.
The produced .gcov files are not simple to read, thus a pretty-printed report can be very useful. FoBiS.py has its own analyzer able to generate a pretty-printed report in markdown format.
The syntax of this intrinsic rule is the following:
FoBiS.py rule -gcov_analyzer GCOV_REPORTS_DIR [REPORT_SUMMARY_FILE_NAME]the GCOV_REPORTS_DIR is required and indicates the directory where the reports are placed. The REPORT_SUMMARY_FILE_NAME is optional and indicated the title and also the file name (without extension and without path) of summary file containing a summary of all the analyzed files. In the present example we can run
FoBiS.py rule -gcov_analyzer coverage-reports/ Coverage-AnalysisThe generated files are:
coverage-reports/Coverage-Analysis.mdcoverage-reports/cumbersome.f90.gcov-report.mdcoverage-reports/first_dep.f90.gcov-report.md
An example of a FoBiS.py summary report can be seen here and a report of single file here.
All the above steps can be conveniently packed into a standard fobos rule defined inside a fobos file:
[rule-coverage-analysis]
help = Perform coverage analysis
rule_1 = FoBiS.py build -compiler gnu -coverage --target src/cumbersome.f90 -o cumbersome
rule_2 = ./cumbersome
rule_3 = gcov -o obj/ src/cumbersome.f90 src/nested-1/first_dep.f90
rule_4 = mkdir -p coverage-reports
rule_5 = FoBiS.py rule -gcov_analyzer coverage-reports Coverage-Analysis
rule_6 = rm -f *.gcovIn the examples linked above you can see nice pie charts representing the covered and uncovered parts of the code. This charts are generated by means of the google chart API through the pygooglechart python module, see the Requirements.
-
Getting-Started
- A Taste of FoBiS.py
- fobos: the FoBiS.py makefile
- FoBiS.py in action
- FAQ