amccarth created this revision.
amccarth added a reviewer: zturner.
amccarth added a subscriber: lldb-commits.

This solves a flaky test on Windows.

We have similar logic elsewhere for log files.  I considered trying to combine 
them, but since they are methods of different objects, there wasn't really a 
clean approach.

http://reviews.llvm.org/D18912

Files:
  packages/Python/lldbsuite/test/lldbtest.py

Index: packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1996,4 +1996,10 @@
     @classmethod
     def RemoveTempFile(cls, file):
         if os.path.exists(file):
-            os.remove(file)
+            try:
+                os.remove(file)
+            except:
+                # On Windows, we can sometimes need a retry because 
antimalware may
+                # briefly hold the file open.
+                time.sleep(0.5)
+                os.remove(file)


Index: packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1996,4 +1996,10 @@
     @classmethod
     def RemoveTempFile(cls, file):
         if os.path.exists(file):
-            os.remove(file)
+            try:
+                os.remove(file)
+            except:
+                # On Windows, we can sometimes need a retry because antimalware may
+                # briefly hold the file open.
+                time.sleep(0.5)
+                os.remove(file)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to