10708e647SAlex Bennée#!/bin/sh 20708e647SAlex Bennée# 30708e647SAlex Bennée# Author: Alex Bennée <alex.bennee@linaro.org> 40708e647SAlex Bennée# 50708e647SAlex Bennée# Summerise the state of code coverage with gcovr and tweak the output 6*04250c69SPhilippe Mathieu-Daudé# to be more sane on CI runner. As we expect to be executed on a 70708e647SAlex Bennée# throw away CI instance we do spam temp files all over the shop. You 80708e647SAlex Bennée# most likely don't want to execute this script but just call gcovr 90708e647SAlex Bennée# directly. See also "make coverage-report" 100708e647SAlex Bennée# 110708e647SAlex Bennée# This code is licensed under the GPL version 2 or later. See 120708e647SAlex Bennée# the COPYING file in the top-level directory. 130708e647SAlex Bennée 140708e647SAlex Bennée# first generate the coverage report 150708e647SAlex Bennéegcovr -p -o raw-report.txt 160708e647SAlex Bennée 170708e647SAlex Bennée# strip the full-path and line markers 180708e647SAlex Bennéesed s@$PWD\/@@ raw-report.txt | sed s/[0-9]\*[,-]//g > simplified.txt 190708e647SAlex Bennée 200708e647SAlex Bennée# reflow lines that got split 210708e647SAlex Bennéeawk '/.[ch]$/ { printf("%s", $0); next } 1' simplified.txt > rejoined.txt 220708e647SAlex Bennée 230708e647SAlex Bennée# columnify 240708e647SAlex Bennéecolumn -t rejoined.txt > final.txt 250708e647SAlex Bennée 260708e647SAlex Bennée# and dump, stripping out 0% coverage 270708e647SAlex Bennéegrep -v "0%" final.txt 28