diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-03-16 10:48:10 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-03-16 10:48:10 +0000 |
commit | bb0b6eddaf546a5f135ce9d0292b61e12ce7c16b (patch) | |
tree | 4a7c5a81a997d43d271f73798df8161f77a500e8 /utils/lit | |
parent | 7c6ac2ebabd800595c3da2acd2e21b8340e0904e (diff) | |
download | external_llvm-bb0b6eddaf546a5f135ce9d0292b61e12ce7c16b.zip external_llvm-bb0b6eddaf546a5f135ce9d0292b61e12ce7c16b.tar.gz external_llvm-bb0b6eddaf546a5f135ce9d0292b61e12ce7c16b.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152916 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit')
-rw-r--r-- | utils/lit/lit/TestRunner.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py index 2a42fd9..fa69f72 100644 --- a/utils/lit/lit/TestRunner.py +++ b/utils/lit/lit/TestRunner.py @@ -98,7 +98,6 @@ def executeShCmd(cmd, cfg, cwd, results): input = subprocess.PIPE stderrTempFiles = [] opened_files = [] - written_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 @@ -146,6 +145,7 @@ def executeShCmd(cmd, cfg, cwd, results): else: if r[2] is None: if kAvoidDevNull and r[0] == '/dev/null': + r[0] = None r[2] = tempfile.TemporaryFile(mode=r[1]) else: 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. if r[1] == 'a': r[2].seek(0, 2) - opened_files.append(r[2]) - if r[1] in 'aw': - written_files.append(r[0]) + opened_files.append(r) result = r[2] 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 # handles have already been transferred so we do not need them anymore. for f in opened_files: - f.close() + f[2].close() # FIXME: There is probably still deadlock potential here. Yawn. procData = [None] * len(procs) @@ -257,10 +255,11 @@ def executeShCmd(cmd, cfg, cwd, results): else: exitCode = res - # Make sure written_files is released by other (child) processes. - if (kIsWindows): - for f in written_files: - WinWaitReleased(f) + # Make sure opened_files is released by other (child) processes. + if kIsWindows: + for f in opened_files: + if f[0] is not None: + WinWaitReleased(f[0]) # Remove any named temporary files we created. for f in named_temp_files: |