Debian Codegraph @

script/coverage

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 set -euo pipefail
4
5 ext=".coverprofile"
6
7 # Temporary working directory.
8 workdir=$(mktempscip-shell system . . mktemp. -d)
9
10 function cleanupscip-shell shell shell-project 0.0.0 cleanup().() {
11 rmscip-shell system . . rm. -rf "${workdir}"
12 }
13 trap cleanup EXIT
14
15 # Clean existing coverage files.
16 findscip-shell system . . find. . -name '*'${ext} | xargsscip-shell system . . xargs. rm -f
17
18 # Unit test coverage.
19 goscip-shell system . . go. test -covermode=count -coverprofile=unittests${ext} ./...
20
21 # Integration test coverage.
22 #
23 # Collect for each individual avo assembly generator.
24 coverbase="${workdir}/cover"
25 coversingle="${coverbase}/test"
26 mkdirscip-shell system . . mkdir. -p "${coversingle}"
27
28 coverdirs=()
29 for main in $(findscip-shell system . . find. . -name 'asm.go'); do
30 dir=$(dirnamescip-shell system . . dirname. ${main})
31 name=$(basenamescip-shell system . . basename. ${dir})
32
33 coverdir="${coversingle}/${name}"
34 mkdirscip-shell system . . mkdir. "${coverdir}"
35 GOCOVERDIR="${coverdir}" goscip-shell system . . go. run -tags=integration -cover "${main}" -out /dev/nullscip-shell filesystem . . `/dev/null`.
36
37 coverdirs+=("${coverdir}")
38 done
39
40 # Merge integration test coverage.
41 covermergeinputs=$(IFS=","; echoscip-shell system . . echo. "${coverdirs[*]}")
42 covermergeoutput="${coverbase}/merge"
43 mkdirscip-shell system . . mkdir. "${covermergeoutput}"
44 goscip-shell system . . go. tool covdata merge -i="${covermergeinputs}" -o="${covermergeoutput}"
45 goscip-shell system . . go. tool covdata textfmt -i="${covermergeoutput}" -o="integration${ext}"