coverage-summary.sh 885 B

123456789101112131415161718192021222324252627
  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 Travis hosts. 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. # first generate the coverage report
  14. gcovr -p -o raw-report.txt
  15. # strip the full-path and line markers
  16. sed s@$PWD\/@@ raw-report.txt | sed s/[0-9]\*[,-]//g > simplified.txt
  17. # reflow lines that got split
  18. awk '/.[ch]$/ { printf("%s", $0); next } 1' simplified.txt > rejoined.txt
  19. # columnify
  20. column -t rejoined.txt > final.txt
  21. # and dump, stripping out 0% coverage
  22. grep -v "0%" final.txt