diff options
author | Francois Pichet <pichet2000@gmail.com> | 2012-03-16 22:50:01 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2012-03-16 22:50:01 +0000 |
commit | 391c14530bc7573756c2b3d9b483853aeecaf34e (patch) | |
tree | e638654b0d21c36eea2e6e4e1831ebd7cd3ff64d /utils | |
parent | 748c1ec713bb592d44827d08c40876cec3ecc644 (diff) | |
download | external_llvm-391c14530bc7573756c2b3d9b483853aeecaf34e.zip external_llvm-391c14530bc7573756c2b3d9b483853aeecaf34e.tar.gz external_llvm-391c14530bc7573756c2b3d9b483853aeecaf34e.tar.bz2 |
Revert r152915. Chapuni's WinWaitReleased refactoring: It doesn't work for me
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152958 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/lit/lit/TestRunner.py | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py index fa69f72..494ad0d 100644 --- a/utils/lit/lit/TestRunner.py +++ b/utils/lit/lit/TestRunner.py @@ -29,20 +29,12 @@ def RemoveForce(f): except OSError: pass -def WinWaitReleased(f): - import time, win32file +def WinRename(f_o, f_n): + import time retry_cnt = 256 - while True: + while (True): try: - h = win32file.CreateFile( - f, - 0, # Querying, neither GENERIC_READ nor GENERIC_WRITE - 0, # Exclusive - None, - win32file.OPEN_EXISTING, - win32file.FILE_ATTRIBUTE_NORMAL, - None) - h.close() + os.rename(f_o, f_n) break except WindowsError, (winerror, strerror): retry_cnt = retry_cnt - 1 @@ -53,6 +45,21 @@ def WinWaitReleased(f): else: raise +def WinWaitReleased(f): + import random + t = "%s%06d" % (f, random.randint(0, 999999)) + RemoveForce(t) + try: + WinRename(f, t) # rename + WinRename(t, f) # restore + except WindowsError, (winerror, strerror): + if winerror in (2, 3): + # 2: ERROR_FILE_NOT_FOUND + # 3: ERROR_PATH_NOT_FOUND + pass + else: + raise + def executeCommand(command, cwd=None, env=None): p = subprocess.Popen(command, cwd=cwd, stdin=subprocess.PIPE, |