[Lldb-commits] [PATCH] D12641: Work around a race condition in lldbtest.py for Windows.

Adrian McCarthy via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 4 13:50:01 PDT 2015

This revision was automatically updated to reflect the committed changes.
Closed by commit rL246870: Sleep-and-retry after a failure to delete a log file, which may be becauseā€¦ (authored by amccarth).

Changed prior to commit:




Index: lldb/trunk/test/lldbtest.py
--- lldb/trunk/test/lldbtest.py
+++ lldb/trunk/test/lldbtest.py
@@ -1791,7 +1791,17 @@
             # success!  (and we don't want log files) delete log files
             for log_file in log_files_for_this_test:
-                os.unlink(log_file)
+                try:
+                    os.unlink(log_file)
+                except:
+                    # We've seen consistent unlink 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.
+                    # Attempts to figure out exactly what process was still holding a file handle
+                    # have failed because running instrumentation like Process Monitor seems to
+                    # slow things down enough that the problem becomes much less consistent.
+                    time.sleep(0.5)
+                    os.unlink(log_file)
     # ====================================================
     # Config. methods supported through a plugin interface

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12641.34071.patch
Type: text/x-patch
Size: 1227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150904/0b7c05a9/attachment.bin>

More information about the lldb-commits mailing list