]> granicus.if.org Git - llvm/commitdiff
Fix some lit test ResourceWarnings on Windows
authorAdrian McCarthy <amccarth@google.com>
Tue, 18 Jun 2019 16:36:57 +0000 (16:36 +0000)
committerAdrian McCarthy <amccarth@google.com>
Tue, 18 Jun 2019 16:36:57 +0000 (16:36 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363700 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/TestRunner.py

index fdaaa922d55d72742fe7e422458f6d27dbaa475f..69fa4e0d47bfe5377c0c77379b1cc5ffd0e69d73 100644 (file)
@@ -991,6 +991,7 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
     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):