-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbdef3c
commit 0b0f7bd
Showing
2 changed files
with
58 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,59 @@ | ||
#!/bin/bash | ||
|
||
go install github.com/ory/go-acc@latest | ||
|
||
touch ./coverage.tmp | ||
echo 'mode: atomic' > coverage.txt | ||
go list ./... | grep -v /cmd | grep -v /vendor | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.tmp -coverpkg $(go list ./... | grep -v /vendor | tr "\n" ",") {} && tail -n +2 coverage.tmp >> coverage.txt || exit 255' && rm coverage.tmp | ||
|
||
|
||
# set -e | ||
# | ||
# echo "" > coverage.txt | ||
# | ||
# mkdir -p ./testdata/ | ||
# | ||
# # Package list | ||
# export PKGS=$(go list ./... | grep -v c4go/testdata | grep -v c4go/examples | grep -v c4go/tests | grep -v /vendor/ | tr '\n' ' ') | ||
# | ||
# # Make comma-separated. | ||
# export PKGS_DELIM=$(echo "$PKGS" | tr ' ' ',') | ||
# | ||
# echo "PKGS : $PKGS" | ||
# echo "PKGS_DELIM : $PKGS_DELIM" | ||
# | ||
# go test \ | ||
# -cover \ | ||
# -timeout=30m \ | ||
# -coverpkg=$PKGS_DELIM \ | ||
# -coverprofile=./testdata/pkg.coverprofile $PKGS | ||
# | ||
# # Merge coverage profiles. | ||
# COVERAGE_FILES=`ls -1 ./testdata/*.coverprofile 2>/dev/null | wc -l` | ||
# if [ $COVERAGE_FILES != 0 ]; then | ||
# # check program `gocovmerge` is exist | ||
# if which gocovmerge >/dev/null 2>&1; then | ||
# export FILES=$(ls testdata/*.coverprofile | tr '\n' ' ') | ||
# echo "Combine next coverprofiles : $FILES" | ||
# gocovmerge $FILES > coverage.txt | ||
# fi | ||
# fi | ||
|
||
# echo "" > coverage.out | ||
# for d in $(go list ./... | grep -v vendor); do | ||
# go test -v -race -coverprofile=profile.out -covermode=atomic $d | ||
# if [ -f profile.out ]; then | ||
# cat profile.out >> coverage.out | ||
# rm profile.out | ||
# fi | ||
# done | ||
|
||
# echo "End of coverage" | ||
# go install github.com/ory/go-acc@latest | ||
# | ||
# touch ./coverage.tmp | ||
# echo 'mode: atomic' > coverage.txt | ||
# go list ./... | grep -v /cmd | grep -v /vendor | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.tmp -coverpkg $(go list ./... | grep -v /vendor | tr "\n" ",") {} && tail -n +2 coverage.tmp >> coverage.txt || exit 255' && rm coverage.tmp | ||
|
||
|
||
set -e | ||
|
||
echo "" > coverage.txt | ||
|
||
mkdir -p ./testdata/ | ||
|
||
# github.com/Konstantin8105/c4go | ||
# github.com/Konstantin8105/c4go/ast | ||
# github.com/Konstantin8105/c4go/examples // ignore | ||
# github.com/Konstantin8105/c4go/noarch | ||
# github.com/Konstantin8105/c4go/preprocessor | ||
# github.com/Konstantin8105/c4go/program | ||
# github.com/Konstantin8105/c4go/scripts | ||
# github.com/Konstantin8105/c4go/testdata // ignore | ||
# github.com/Konstantin8105/c4go/tests // ignore | ||
# github.com/Konstantin8105/c4go/transpiler | ||
# github.com/Konstantin8105/c4go/types | ||
# github.com/Konstantin8105/c4go/util | ||
# github.com/Konstantin8105/c4go/version | ||
|
||
# Package list | ||
# export PKGS="github.com/Konstantin8105/c4go github.com/Konstantin8105/c4go/ast github.com/Konstantin8105/c4go/noarch github.com/Konstantin8105/c4go/preprocessor github.com/Konstantin8105/c4go/program github.com/Konstantin8105/c4go/scripts github.com/Konstantin8105/c4go/transpiler github.com/Konstantin8105/c4go/types github.com/Konstantin8105/c4go/util github.com/Konstantin8105/c4go/version" | ||
export PKGS="github.com/Konstantin8105/c4go github.com/Konstantin8105/c4go/ast github.com/Konstantin8105/c4go/version" | ||
# $(go list ./... | grep -v c4go/testdata | grep -v c4go/examples | grep -v c4go/tests | grep -v /vendor/ | tr '\n' ' ') | ||
|
||
# Make comma-separated. | ||
export PKGS_DELIM=$(echo "$PKGS" | tr ' ' ',') | ||
|
||
echo "PKGS : $PKGS" | ||
echo "PKGS_DELIM : $PKGS_DELIM" | ||
|
||
go test \ | ||
-cover \ | ||
-covermode=atomic \ | ||
-timeout=30m \ | ||
-coverpkg=$PKGS_DELIM \ | ||
-coverprofile=./testdata/pkg.coverprofile $PKGS | ||
|
||
# Merge coverage profiles. | ||
COVERAGE_FILES=`ls -1 ./testdata/*.coverprofile 2>/dev/null | wc -l` | ||
if [ $COVERAGE_FILES != 0 ]; then | ||
# check program `gocovmerge` is exist | ||
if which gocovmerge >/dev/null 2>&1; then | ||
export FILES=$(ls testdata/*.coverprofile | tr '\n' ' ') | ||
echo "Combine next coverprofiles : $FILES" | ||
gocovmerge $FILES > coverage.txt | ||
fi | ||
fi | ||
|
||
echo "End of coverage" |