[llvm-commits] [llvm] r105888 - /llvm/trunk/utils/lit/lit/TestRunner.py
Daniel Dunbar
daniel at zuster.org
Sat Jun 12 09:00:10 PDT 2010
Author: ddunbar
Date: Sat Jun 12 11:00:10 2010
New Revision: 105888
URL: http://llvm.org/viewvc/llvm-project?rev=105888&view=rev
Log:
lit: Replace /dev/null in scripts with temporary files on Windows.
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=105888&r1=105887&r2=105888&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Sat Jun 12 11:00:10 2010
@@ -66,6 +66,7 @@
input = subprocess.PIPE
stderrTempFiles = []
opened_files = []
+ named_temp_files = []
# To avoid deadlock, we use a single stderr stream for piped
# output. This is null until we have seen some output using
# stderr.
@@ -148,6 +149,15 @@
if not args[0]:
raise InternalShellError(j, '%r: command not found' % j.args[0])
+ # Replace uses of /dev/null with temporary files.
+ if kAvoidDevNull:
+ for i,arg in enumerate(args):
+ if arg == "/dev/null":
+ f = tempfile.NamedTemporaryFile(delete=False)
+ f.close()
+ named_temp_files.append(f.name)
+ args[i] = f.name
+
procs.append(subprocess.Popen(args, cwd=cwd,
stdin = stdin,
stdout = stdout,
@@ -209,6 +219,13 @@
for f in opened_files:
f.close()
+ # Remove any named temporary files we created.
+ for f in named_temp_files:
+ try:
+ os.remove(f)
+ except OSError:
+ pass
+
if cmd.negate:
exitCode = not exitCode
More information about the llvm-commits
mailing list