Skip to content

Commit

Permalink
fix sonar not finding erigon-lib coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
taratorio committed Apr 23, 2024
1 parent 54a3134 commit e22b711
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ go.work*
docker-compose.*.yml
.env
coverage.out
coverage-erigon.out
coverage-erigon-lib.out
coverage-total.out

dist
__debug_bin
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ test-erigon-ext:

## test: run unit tests with a 100s timeout
test: test-erigon-lib
$(GOTEST) --timeout 10m -coverprofile=coverage-erigon.out
$(GOTEST) --timeout 10m -coverprofile=coverage.out

test3: test-erigon-lib
$(GOTEST) --timeout 10m -tags $(BUILD_TAGS),e3
Expand Down Expand Up @@ -313,7 +313,7 @@ user_macos:
## coverage: run code coverage report and output total coverage %
.PHONY: coverage
coverage:
@go test -coverprofile=coverage.out ./... > /dev/null 2>&1 && go tool cover -func coverage.out | grep total | awk '{print substr($$3, 1, length($$3)-1)}'
@go test -coverprofile=coverage-total.out ./... > /dev/null 2>&1 && go tool cover -func coverage-total.out | grep total | awk '{print substr($$3, 1, length($$3)-1)}'

## hive: run hive test suite locally using docker e.g. OUTPUT_DIR=~/results/hive SIM=ethereum/engine make hive
.PHONY: hive
Expand Down
2 changes: 2 additions & 0 deletions erigon-lib/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ libmdbx/build/*
tests/testdata/*

go.work*

coverage.out
2 changes: 1 addition & 1 deletion erigon-lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ lint-deps: lintci-deps lint-licenses-deps
lint: lintci lint-licenses lint-mod-tidy

test:
$(GOTEST) --count 1 -p 2 -coverprofile=coverage-erigon-lib.out ./...
$(GOTEST) --count 1 -p 2 -coverprofile=coverage.out ./...

test-no-fuzz:
$(GOTEST_NOFUZZ) --count 1 -p 2 ./...
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sonar.exclusions=**/*.pb.go,**/gen_*.go,**/graphql/graph/generated.go,**/*.sol,c
sonar.tests=.
sonar.test.inclusions=**/*_test.go,tests/**

sonar.go.coverage.reportPaths=coverage-erigon.out,coverage-erigon-lib.out
sonar.go.coverage.reportPaths=coverage.out,erigon-lib/coverage.out

# The only way to get an accurate analysis of C/C++/Objective-C files is
# by using the SonarSource build-wrapper and setting the property "sonar.cfamily.build-wrapper-output"
Expand Down

0 comments on commit e22b711

Please sign in to comment.