-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_coverage_html.sh
executable file
·78 lines (65 loc) · 1.67 KB
/
gen_coverage_html.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/bash
set -o errexit # abort on nonzero exitstatus
set -o nounset # abort on unbound variable
set -o pipefail # don't hide errors within pipes
export COVDATA="$(pwd)/covdata"
export COVERPKG="go.l0nax.org/typact,go.l0nax.org/typact/std,go.l0nax.org/typact/std/option,go.l0nax.org/typact/std/exp,go.l0nax.org/typact/std/exp/cmpop,go.l0nax.org/typact/std/exp/pred,go.l0nax.org/typact/std/exp/xslices,go.l0nax.org/typact/std/xhash"
function clean_data {
rm -rf ${COVDATA}
rm -rf ./coverage
rm -rf ./unit-tests.xml
rm -rf ./coverage.txt
rm -rf ./coverage.xml
}
clean_data
mkdir -p ${COVDATA}
mkdir -p $(pwd)/coverage
go test -v \
-cover \
-covermode=atomic \
-coverpkg=${COVERPKG} \
./ -args -test.gocoverdir="${COVDATA}"
go test -v \
-cover \
-covermode=atomic \
-coverpkg=${COVERPKG} \
./std/... -args -test.gocoverdir="${COVDATA}"
(
cd ./testing/option
go test -v \
-cover \
-covermode=atomic \
-coverpkg=${COVERPKG} \
./... -args -test.gocoverdir="${COVDATA}"
)
(
cd ./testing/std/exp
go test -v \
-cover \
-covermode=atomic \
-coverpkg=${COVERPKG} \
./... -args -test.gocoverdir="${COVDATA}"
)
(
cd ./std/option
go test -v \
-cover \
-covermode=atomic \
-coverpkg=${COVERPKG} \
./... -args -test.gocoverdir="${COVDATA}"
)
(
cd ./std
go test -v \
-cover \
-covermode=atomic \
-coverpkg=${COVERPKG} \
./... -args -test.gocoverdir="${COVDATA}"
)
###### Generating report
mkdir -p ./coverage
go tool covdata merge -i="${COVDATA}" -o ./coverage
go tool covdata percent -i ./coverage
go tool covdata textfmt -i ./coverage -o ./coverage.txt
go tool cover -html=coverage.txt
clean_data