File: coverage.sh

package info (click to toggle)
golang-github-advancedlogic-goose 0.0~git20200830.1225d53%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, bullseye-backports
  • size: 472 kB
  • sloc: makefile: 128; sh: 11
file content (17 lines) | stat: -rwxr-xr-x 649 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

# Run test coverage on each subdirectory and merge the coverage profile.
echo "mode: count" > target/report/profile.cov

# Standard go tooling behavior is to ignore dirs with leading underscors
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); do
    if ls $dir/*.go &> /dev/null; then
        go test -covermode=count -coverprofile=$dir/profile.tmp $dir
        if [ -f $dir/profile.tmp ]; then
            cat $dir/profile.tmp | tail -n +2 >> target/report/profile.cov
            rm $dir/profile.tmp
        fi
    fi
done
go tool cover -html target/report/profile.cov -o target/report/coverage.html