2019-01-06 20:28:43 -08:00
|
|
|
#!/bin/bash -ex
|
2019-01-02 20:41:59 -08:00
|
|
|
|
|
|
|
|
ext=".coverprofile"
|
|
|
|
|
|
|
|
|
|
# Clean existing coverage files.
|
|
|
|
|
find . -name '*'${ext} | xargs rm -f
|
|
|
|
|
|
|
|
|
|
# Unit test coverage.
|
2019-01-09 21:51:20 -08:00
|
|
|
go test -covermode=count -coverprofile=unittests${ext} ./...
|
2019-01-02 20:41:59 -08:00
|
|
|
|
|
|
|
|
# Integration test coverage.
|
2019-01-09 21:51:20 -08:00
|
|
|
coverprofiles=()
|
|
|
|
|
for main in $(find . -name 'asm.go'); do
|
2019-01-02 20:41:59 -08:00
|
|
|
dir=$(dirname ${main})
|
|
|
|
|
name=$(basename ${dir})
|
|
|
|
|
coverprofile="${dir}/${name}${ext}"
|
|
|
|
|
./script/covermain ${main} ${coverprofile} > /dev/null
|
2019-01-09 21:51:20 -08:00
|
|
|
coverprofiles+=(${coverprofile})
|
2019-01-02 20:41:59 -08:00
|
|
|
done
|
|
|
|
|
|
2019-01-09 21:51:20 -08:00
|
|
|
covertool merge --output integration${ext} ${coverprofiles[@]}
|
|
|
|
|
|
2019-01-02 20:41:59 -08:00
|
|
|
# Merge.
|
2019-01-09 21:58:14 -08:00
|
|
|
covertool merge --output all${ext} unittests${ext} integration${ext}
|