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

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 28 15:42:24 PDT 2015


zturner added inline comments.

================
Comment at: packages/Python/lldbsuite/test/lldbtest.py:1823-1830
@@ -1822,3 +1822,10 @@
 
-                    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:
----------------
I have a patch pending to create an `lldbsuite.support` package.  I wonder if it would be worth sinking this "rename with retry" (and similar for delete-with-retry) into this library.  Then you could call this as:

    lldbsuite.support.filesystem.rename_with_retry(src, dst, 1)  # Retry up to 1 time

I only mention this because this is now the second time we've had to do this (other time right below), so perhaps we might need this again in the future too.

I don't feel too strongly, so up to you.  If you think it's a good idea though, you'll probably need to wait until my CL goes in first so that you can add this method to the package (which doesn't exist yet)


http://reviews.llvm.org/D14163





More information about the lldb-commits mailing list