Page MenuHomePhabricator

Fix some lit test ResourceWarnings on Windows

Authored by amccarth on Jun 10 2019, 3:46 PM.



When running LLDB lit tests on Windows, the system selects a debug version of Python, which was issuing lots of
ResourceWarnings about files that weren't closed. There are two kinds of them, and each test triggered one of each.

This patch fixes one kind by ensuring TestRunner explicitly close the temporary files created for routing stderr. This is important on Windows but has no net effect on Posix systems.

The remaining ResourceWarnings are more elusive; the bug may lie in the Python library, and it may be Windows-specific.

Diff Detail


Event Timeline

amccarth created this revision.Jun 10 2019, 3:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 10 2019, 3:46 PM
Herald added a subscriber: delcypher. · View Herald Transcript
This revision is now accepted and ready to land.Jun 11 2019, 9:18 AM
delcypher added inline comments.Jun 11 2019, 10:24 AM
772 ↗(On Diff #203919)

What does this change have to do with closing files?

amccarth marked an inline comment as done.Jun 17 2019, 4:15 PM
amccarth added inline comments.
772 ↗(On Diff #203919)

That was a leftover change from the diagnosis phase. The resource leak was always reported on the following line (773), so a lot of the attention was focused in this region even though the actual fix was below.

I was just trying to leave the code a little cleaner than I found it by eliminating the unused variable. But, you're right, it's not relevant to the point of this patch, so I'll undo it.

This revision was automatically updated to reflect the committed changes.