Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix coverage files combining #552

Merged
merged 2 commits into from
Oct 8, 2019
Merged

Conversation

saschagrunert
Copy link
Contributor

Hey, this enhancement should fix #518.

@williammartin
Copy link
Collaborator

Thanks for the PR. Is there a test we can write to get coverage of this?

@saschagrunert
Copy link
Contributor Author

Yeah sure, I will add an integration test.

@saschagrunert
Copy link
Contributor Author

@williammartin I am wondering why the test on go 1.9 fails. Could it be possible that it is the case because the travis machine still installs from github.com/onsi/ginkgo/ginkgo and runs this executable?

I guess for integration testing of forks the binary needs to be built locally, right?

@NilsJPWerner
Copy link

Any updates on when this will be fixed/merged?

@williammartin
Copy link
Collaborator

I can reproduce this failure on go 1.10.7 by focussing the changed spec. Will keep digging.

@saschagrunert
Copy link
Contributor Author

@williammartin Is there anything I can do here? I guess the failing pipeline is related to the go fetch source...

@williammartin
Copy link
Collaborator

Well, I was just having a look at the contents of this file: https://github.com/onsi/ginkgo/pull/552/files#diff-28605e74bddc91d19789edefa99640b8R121

And indeed, in 1.10 it looks like this:

mode: atomic
mode: atomic
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go:3.17,5.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go:7.17,9.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go:11.17,13.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go:15.17,17.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go:19.17,21.2 1 0
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go:3.17,5.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go:7.17,9.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go:11.17,13.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go:15.17,17.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go:19.17,21.2 1 1

and in 1.11:

mode: atomic
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go:3.17,5.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go:7.17,9.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go:11.17,13.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go:15.17,17.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go:19.17,21.2 1 0
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go:3.17,5.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go:7.17,9.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go:11.17,13.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go:15.17,17.2 1 1
github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go:19.17,21.2 1 1

Something funny in 1.10 is resulting in keeping the duplicate mode: atomic lines

@williammartin
Copy link
Collaborator

For some reason the coverage file in Go 1.10 has mode: atomic in it already.

https://github.com/onsi/ginkgo/blob/master/ginkgo/run_command.go#L166

@saschagrunert
Copy link
Contributor Author

I must say this makes me not happy. So do we have to add a hack-around for go 1.10/11?

@williammartin
Copy link
Collaborator

I don't fully understand what is causing the difference yet. Ideally I'd like to reproduce a simple case of this behaviour without ginkgo to ensure I understand where the difference is and what the behaviour is.

@rohitsakala
Copy link

Hi, any update on this issue ?

@zhandao
Copy link

zhandao commented Oct 8, 2019

Looking forward to merging it

@williammartin
Copy link
Collaborator

I do not have the time to look at this issue right now (sorry for the lack of communication), if we want to merge this soon, I'll need help debugging the failing builds.

Thanks!

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666)
combined, err := os.OpenFile(
filepath.Join(path, r.getCoverprofile()),
os.O_WRONLY|os.O_CREATE,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the go 1.10 bug by removing os.O_APPEND

@saschagrunert
Copy link
Contributor Author

Rebased on top of the latest master and applied a fix for the go1.10 issue.

@williammartin
Copy link
Collaborator

LGTM thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Combining the coverprofiles to one file should remove the mode (mode: xxx) line
5 participants