Skip to content

Commit f952d20

Browse files
authored
Merge pull request #71 from infosiftr/coverpkg
Add `-coverpkg=./...` to all our coverage generation
2 parents bba9660 + 5b8394c commit f952d20

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

.test/test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ time "$coverage/builds.sh" --cache "$dir/cache-builds.json" "$dir/sources.json"
7272
time "$coverage/builds.sh" --cache="$dir/cache-builds.json" "$dir/sources.json" > "$dir/builds.json"
7373

7474
# test "lookup" code for more edge cases
75-
"$dir/../.go-env.sh" go build -cover -trimpath -o "$coverage/bin/lookup" ./cmd/lookup
75+
"$dir/../.go-env.sh" go build -coverpkg=./... -trimpath -o "$coverage/bin/lookup" ./cmd/lookup
7676
lookup=(
7777
# force a config blob lookup for platform object creation (and top-level Docker media type!)
7878
'tianon/test@sha256:2f19ce27632e6baf4ebb1b582960d68948e52902c8cfac10133da0058f1dab23'
@@ -130,7 +130,7 @@ lookup=(
130130
if [ -n "$doDeploy" ]; then
131131
# also test "deploy" (optional, disabled by default, because it's a much heavier test)
132132

133-
"$dir/../.go-env.sh" go build -cover -trimpath -o "$coverage/bin/deploy" ./cmd/deploy
133+
"$dir/../.go-env.sh" go build -coverpkg=./... -trimpath -o "$coverage/bin/deploy" ./cmd/deploy
134134

135135
docker rm -vf meta-scripts-test-registry &> /dev/null || :
136136
trap 'docker rm -vf meta-scripts-test-registry &> /dev/null || :' EXIT
@@ -220,7 +220,7 @@ if [ -n "$doDeploy" ]; then
220220
fi
221221

222222
# Go tests
223-
"$dir/../.go-env.sh" go test -cover ./... -args -test.gocoverdir="$GOCOVERDIR"
223+
"$dir/../.go-env.sh" go test -coverpkg=./... ./... -args -test.gocoverdir="$GOCOVERDIR"
224224

225225
# combine the coverage data into the "legacy" coverage format (understood by "go tool cover") and pre-generate HTML for easier digestion of the data
226226
"$dir/../.go-env.sh" go tool covdata textfmt -i "$GOCOVERDIR" -o "$coverage/coverage.txt"

builds.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dir="$(dirname "$dir")"
1717
if ( cd "$dir" && ./.any-go-nt.sh "$bin" ); then
1818
{
1919
echo "building '$bin'"
20-
"$dir/.go-env.sh" go build ${GOCOVERDIR:+-cover} -v -trimpath -o "$bin" ./cmd/builds
20+
"$dir/.go-env.sh" go build ${GOCOVERDIR:+-coverpkg=./...} -v -trimpath -o "$bin" ./cmd/builds
2121
ls -l "$bin"
2222
} >&2
2323
fi

0 commit comments

Comments
 (0)