[llvm] r363700 - Fix some lit test ResourceWarnings on Windows

Adrian McCarthy via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 09:36:57 PDT 2019


Author: amccarth
Date: Tue Jun 18 09:36:57 2019
New Revision: 363700

URL: http://llvm.org/viewvc/llvm-project?rev=363700&view=rev
Log:
Fix some lit test ResourceWarnings on Windows

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.

Differential Revision: https://reviews.llvm.org/D63102

Modified:
    llvm/trunk/utils/lit/lit/TestRunner.py

Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=363700&r1=363699&r2=363700&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Tue Jun 18 09:36:57 2019
@@ -991,6 +991,7 @@ def _executeShCmd(cmd, shenv, results, t
     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):




More information about the llvm-commits mailing list