[Lldb-commits] [PATCH] D14163: Address another race condition running tests on Windows

Adrian McCarthy via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 28 15:32:14 PDT 2015

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.



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.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)
             # success!  (and we don't want log files) delete log files
             for log_file in log_files_for_this_test:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14163.38693.patch
Type: text/x-patch
Size: 1005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151028/211aa22b/attachment.bin>

More information about the lldb-commits mailing list