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

Write coverage marker to disk immediately. Don't wait for ProcessExit. Fixes #18 #24

Closed
wants to merge 1 commit into from

Conversation

StillLearnin
Copy link

This will slow down tests because of multiple disk writes instead of only writing once at the end of the process. This, in my opinion, is preferable to incorrect results. The reduced speed shouldn't be too noticeable for small tests.

Copy link
Collaborator

@tonerdo tonerdo left a comment

Choose a reason for hiding this comment

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

This is a good start but as you can see from the failing test that it takes too long to run. A better approach might be to write to the hits file in batches. E.g write to the file whenever the length of the markers are 100,000 and then re-instantiate the object. Let me know your thoughts.

@@ -25,13 +24,8 @@ public static void MarkExecuted(string path, string marker)
{
_markers.TryAdd(path, new List<string>());
_markers[path].Add(marker);
File.WriteAllLines(path, _markers[path]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This won't work on Windows, you'd get a whole lot of File in use by another process errors

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.

2 participants