Skip to content

Commit

Permalink
fix: Allow test and cover script to run without enabling Rust coverage (
Browse files Browse the repository at this point in the history
#126)

Sometimes, we want to run only specific tests that don't include the NSS
module (which means no Rust coverage). The script quit with an error if
it could not merge the Rust coverage to the Go one. This is fine for the
CI since we want all coverage, but the script needs a change to prevent
this.
  • Loading branch information
denisonbarbosa authored Dec 1, 2023
2 parents 9151507 + 29b97e8 commit 820b7c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gotestcov
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ go test -cover -covermode=set $@ -shuffle=on -args -test.gocoverdir="${raw_cov_d
go tool covdata textfmt -i="${raw_cov_dir}" -o="${cov_dir}/coverage.out"

# Append the Rust coverage data to the Go one
cat "${raw_cov_dir}/rust-cov/rust2go_coverage" >>"${cov_dir}/coverage.out"
if [ -f "${raw_cov_dir}/rust-cov/rust2go_coverage" ]; then
cat "${raw_cov_dir}/rust-cov/rust2go_coverage" >>"${cov_dir}/coverage.out"
fi

# Filter out the testutils package and the pb.go file
grep -v -e "testutils" -e "pb.go" "${cov_dir}/coverage.out" >"${cov_dir}/coverage.out.filtered"
Expand Down

0 comments on commit 820b7c8

Please sign in to comment.