xref: /qemu/scripts/ci/coverage-summary.sh (revision b355f08a)
1#!/bin/sh
2#
3# Author: Alex Bennée <alex.bennee@linaro.org>
4#
5# Summerise the state of code coverage with gcovr and tweak the output
6# to be more sane on CI runner. As we expect to be executed on a
7# throw away CI instance we do spam temp files all over the shop. You
8# most likely don't want to execute this script but just call gcovr
9# directly. See also "make coverage-report"
10#
11# This code is licensed under the GPL version 2 or later.  See
12# the COPYING file in the top-level directory.
13
14# first generate the coverage report
15gcovr -p -o raw-report.txt
16
17# strip the full-path and line markers
18sed s@$PWD\/@@ raw-report.txt | sed s/[0-9]\*[,-]//g > simplified.txt
19
20# reflow lines that got split
21awk '/.[ch]$/ { printf("%s", $0); next } 1' simplified.txt > rejoined.txt
22
23# columnify
24column -t rejoined.txt > final.txt
25
26# and dump, stripping out 0% coverage
27grep -v "0%" final.txt
28