mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 13:11:39 +01:00
lit/TestRunner.py: [Win32] Check all opened_files[] released, rather than (obsoleted) written_files[].
In previous case, RUN: foo -o %t RUN: FileCheck < %t RUN: bar -o %t 2nd read handle might prevent manipulation of 3rd %t in bar, to remove and rename. llvm-svn: 152916
This commit is contained in:
parent
14c056f6e8
commit
b2d7bb031a
@ -98,7 +98,6 @@ def executeShCmd(cmd, cfg, cwd, results):
|
|||||||
input = subprocess.PIPE
|
input = subprocess.PIPE
|
||||||
stderrTempFiles = []
|
stderrTempFiles = []
|
||||||
opened_files = []
|
opened_files = []
|
||||||
written_files = []
|
|
||||||
named_temp_files = []
|
named_temp_files = []
|
||||||
# To avoid deadlock, we use a single stderr stream for piped
|
# To avoid deadlock, we use a single stderr stream for piped
|
||||||
# output. This is null until we have seen some output using
|
# output. This is null until we have seen some output using
|
||||||
@ -146,6 +145,7 @@ def executeShCmd(cmd, cfg, cwd, results):
|
|||||||
else:
|
else:
|
||||||
if r[2] is None:
|
if r[2] is None:
|
||||||
if kAvoidDevNull and r[0] == '/dev/null':
|
if kAvoidDevNull and r[0] == '/dev/null':
|
||||||
|
r[0] = None
|
||||||
r[2] = tempfile.TemporaryFile(mode=r[1])
|
r[2] = tempfile.TemporaryFile(mode=r[1])
|
||||||
else:
|
else:
|
||||||
r[2] = open(r[0], r[1])
|
r[2] = open(r[0], r[1])
|
||||||
@ -154,9 +154,7 @@ def executeShCmd(cmd, cfg, cwd, results):
|
|||||||
# FIXME: Actually, this is probably an instance of PR6753.
|
# FIXME: Actually, this is probably an instance of PR6753.
|
||||||
if r[1] == 'a':
|
if r[1] == 'a':
|
||||||
r[2].seek(0, 2)
|
r[2].seek(0, 2)
|
||||||
opened_files.append(r[2])
|
opened_files.append(r)
|
||||||
if r[1] in 'aw':
|
|
||||||
written_files.append(r[0])
|
|
||||||
result = r[2]
|
result = r[2]
|
||||||
final_redirects.append(result)
|
final_redirects.append(result)
|
||||||
|
|
||||||
@ -218,7 +216,7 @@ def executeShCmd(cmd, cfg, cwd, results):
|
|||||||
# on Win32, for example). Since we have already spawned the subprocess, our
|
# on Win32, for example). Since we have already spawned the subprocess, our
|
||||||
# handles have already been transferred so we do not need them anymore.
|
# handles have already been transferred so we do not need them anymore.
|
||||||
for f in opened_files:
|
for f in opened_files:
|
||||||
f.close()
|
f[2].close()
|
||||||
|
|
||||||
# FIXME: There is probably still deadlock potential here. Yawn.
|
# FIXME: There is probably still deadlock potential here. Yawn.
|
||||||
procData = [None] * len(procs)
|
procData = [None] * len(procs)
|
||||||
@ -257,10 +255,11 @@ def executeShCmd(cmd, cfg, cwd, results):
|
|||||||
else:
|
else:
|
||||||
exitCode = res
|
exitCode = res
|
||||||
|
|
||||||
# Make sure written_files is released by other (child) processes.
|
# Make sure opened_files is released by other (child) processes.
|
||||||
if (kIsWindows):
|
if kIsWindows:
|
||||||
for f in written_files:
|
for f in opened_files:
|
||||||
WinWaitReleased(f)
|
if f[0] is not None:
|
||||||
|
WinWaitReleased(f[0])
|
||||||
|
|
||||||
# Remove any named temporary files we created.
|
# Remove any named temporary files we created.
|
||||||
for f in named_temp_files:
|
for f in named_temp_files:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user