File: calculateoverallcoverage.awk

package info (click to toggle)
martchus-cpp-utilities 5.28.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,352 kB
  • sloc: cpp: 12,471; awk: 18; ansic: 12; makefile: 10
file content (27 lines) | stat: -rw-r--r-- 892 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Calculates total statistics for source-based code coverage report created
# with `llvm-cov report` when at least one source file has been specified.

# NOTE: When at least one source file is passed to `llvm-cov`, the summaries
# are shown for each function in the listed files (and not for each file in the
# coverage data).

{
    if($1 == "TOTAL") {
        total_regions += $2;
        missed_regions += $3;
        total_lines += $5;
        missed_lines += $6;
    }
}

END {
    covered_regions = total_regions - missed_regions;
    covered_lines = total_lines - missed_lines;

    print "Covered regions: " covered_regions;
    print "Missed regions: " missed_regions;
    print "Region cover: " covered_regions/total_regions*100 "%\n";
    print "Covered lines: " covered_lines;
    print "Missed lines: " missed_lines;
    print "Line cover: " covered_lines/total_lines*100 "%";
}