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

Another case where sleep-and-retry avoids file access errors on Windows.

http://reviews.llvm.org/D14163

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
@@ -1820,7 +1820,14 @@
                         # destination first if it already exists.
                         os.remove(dst)
 
-                    os.rename(src, dst)
+                    try:
+                        os.rename(src, dst)
+                    except:
+                        # We've seen consistent rename failures on Windows, 
perhaps because the
+                        # just-created log file is being scanned by 
anti-virus.  Empirically, this
+                        # sleep-and-retry approach allows tests to succeed 
much more reliably.
+                        time.sleep(0.5)
+                        os.rename(src, dst)
         else:
             # success!  (and we don't want log files) delete log files
             for log_file in log_files_for_this_test:


Index: packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1820,7 +1820,14 @@
                         # destination first if it already exists.
                         os.remove(dst)
 
-                    os.rename(src, dst)
+                    try:
+                        os.rename(src, dst)
+                    except:
+                        # We've seen consistent rename failures on Windows, perhaps because the
+                        # just-created log file is being scanned by anti-virus.  Empirically, this
+                        # sleep-and-retry approach allows tests to succeed much more reliably.
+                        time.sleep(0.5)
+                        os.rename(src, dst)
         else:
             # success!  (and we don't want log files) delete log files
             for log_file in log_files_for_this_test:
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to