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

cmd/go: merge coverage profiles from subprocesses #28235

Open
bcmills opened this Issue Oct 16, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@bcmills
Member

bcmills commented Oct 16, 2018

According to this snippet, initCoverProfile clears the coverage profile on every run:

// Using this function clears the profile in case it existed from a previous run,
// or in case it doesn't exist and the test is going to fail to create it (or not run).

That seems counterproductive when we're collecting coverage from a test that runs a binary multiple times (such as the tests for cmd/go itself), or from a test that invokes itself as a subprocess.

Instead, I suspect that we should use OS-level file locking so that we can merge coverage from multiple invocations.

If we do that, I'm not entirely sure when we should remove the previous profile, though.

(CC: @ianlancetaylor @rsc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment