ci_coverage_summary 970 Bytes
Newer Older
1
#!/bin/bash
Andreas Marek's avatar
Andreas Marek committed
2
PATH=${HOME}/bin:${PATH}
3

4 5 6 7 8 9 10 11
for p in coverage_data/coverage_${CI_BUILD_REF}*.package ; do
        cov_file=${p%.package}.info
        lcov -c -b $PWD --from-package $p --output-file $cov_file
        lcov -r $cov_file "/usr/*" -o $cov_file
        lcov -r $cov_file "/afs/*" -o $cov_file
        lcov -r $cov_file "src/ftimings" -o $cov_file
done

12 13 14 15 16 17 18 19 20 21 22
lcov $(for i in coverage_data/coverage_${CI_BUILD_REF}_*.info; do echo -a $i; done) -o coverage_data/coverage_${CI_BUILD_REF}.info
lcov --summary coverage_data/coverage_${CI_BUILD_REF}.info 2>&1 | \
        awk '/lines|functions/ {
                gsub(/\.*:$/, "", $1);
                gsub(/^./, "", $3);
                printf "%s: %s (%s of %s), ", $1, $2, $3, $5;
             }
             /branches/ {
                print "";
             }' | \
        sed 's/^/__COVERAGE__:/; s/, $//;'
23

24 25
mkdir -p public/coverage_summary
genhtml coverage_data/coverage_${CI_BUILD_REF}.info -o public/coverage_summary