[PATCH] D63102: Fix some lit test ResourceWarnings on Windows

Adrian McCarthy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 15:48:37 PDT 2019


amccarth created this revision.
amccarth added reviewers: stella.stamenova, ddunbar.
Herald added a subscriber: delcypher.
Herald added a project: LLVM.

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 subprocess.py, and it may be Windows-specific.


https://reviews.llvm.org/D63102

Files:
  llvm/utils/lit/lit/TestRunner.py


Index: llvm/utils/lit/lit/TestRunner.py
===================================================================
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -769,7 +769,7 @@
 
     if isinstance(cmd, ShUtil.Seq):
         if cmd.op == ';':
-            res = _executeShCmd(cmd.lhs, shenv, results, timeoutHelper)
+            _executeShCmd(cmd.lhs, shenv, results, timeoutHelper)
             return _executeShCmd(cmd.rhs, shenv, results, timeoutHelper)
 
         if cmd.op == '&':
@@ -991,6 +991,7 @@
     for i,f in stderrTempFiles:
         f.seek(0, 0)
         procData[i] = (procData[i][0], f.read())
+        f.close()
 
     exitCode = None
     for i,(out,err) in enumerate(procData):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63102.203919.patch
Type: text/x-patch
Size: 723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190610/8962776d/attachment-0001.bin>


More information about the llvm-commits mailing list