Skip to content

Fix cases where tests fail to clean up files placed in the Temp folder#26320

Merged
sharwell merged 1 commit intodotnet:dev15.7.xfrom
sharwell:tmp-cleanup
Apr 23, 2018
Merged

Fix cases where tests fail to clean up files placed in the Temp folder#26320
sharwell merged 1 commit intodotnet:dev15.7.xfrom
sharwell:tmp-cleanup

Conversation

@sharwell
Copy link
Copy Markdown
Contributor

No description provided.

@sharwell sharwell requested review from a team as code owners April 22, 2018 03:02
@sharwell sharwell added this to the 15.7 milestone Apr 22, 2018
Assert.Contains(source + "(6,16): warning CS0168: The variable 'x' is declared but never used", outWriter.ToString(), StringComparison.Ordinal);

CleanupAllGeneratedFiles(source);
CleanupAllGeneratedFiles(Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(source)), Path.GetFileName(source)));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking through this made me ask: why isn't TempRoot deleting all the temporary files it creates in it's active Dispose pattern? Seems like it would make most of this superfluous.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure. Most of the files end up placed under TempRoot.Root, where several files/folders are not cleaned up after tests. However, this folder is actually placed in the RoslynTests subdirectory of the temporary directory, so it doesn't cause a problem or make it difficult to find/delete just the test files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm tempted to change the TempRoot dispose to have this behavior. It seems pretty sensible. That or have the TempRoot dispose assert / fail if the directory isn't empty.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIRC there might have been some file locking issues, but if we're not seeing them with this change, then yes, we should just move it.

@sharwell
Copy link
Copy Markdown
Contributor Author

@jaredpar @jasonmalinowski Any objection to merging this as a test-only change for dev15.7.x and leaving the remaining comments for future work?

@jaredpar
Copy link
Copy Markdown
Member

@sharwell none from me. My comments were all intended for future work.

Assert.Contains(source + "(6,16): warning CS0168: The variable 'x' is declared but never used", outWriter.ToString(), StringComparison.Ordinal);

CleanupAllGeneratedFiles(source);
CleanupAllGeneratedFiles(Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(source)), Path.GetFileName(source)));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIRC there might have been some file locking issues, but if we're not seeing them with this change, then yes, we should just move it.

@sharwell sharwell merged commit 240ce7c into dotnet:dev15.7.x Apr 23, 2018
@sharwell sharwell deleted the tmp-cleanup branch April 23, 2018 19:18
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.

3 participants