summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian McCarthy <amccarth@google.com>2015-09-04 20:48:48 +0000
committerAdrian McCarthy <amccarth@google.com>2015-09-04 20:48:48 +0000
commita72920410329779314264d9da990c27d405a3fc2 (patch)
treecef26190a7a6d3c687f966a0fec172729acc4c8b
parent2dcc23580e8a1f3e5667726dd5f997b280f4b273 (diff)
downloadbcm5719-llvm-a72920410329779314264d9da990c27d405a3fc2.tar.gz
bcm5719-llvm-a72920410329779314264d9da990c27d405a3fc2.zip
Sleep-and-retry after a failure to delete a log file, which may be because antimalware is holding the handle to the just-created file.
Differential Revision: http://reviews.llvm.org/D12641 llvm-svn: 246870
-rw-r--r--lldb/test/lldbtest.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py
index ff77dc2bf7c..7a0b706384c 100644
--- a/lldb/test/lldbtest.py
+++ b/lldb/test/lldbtest.py
@@ -1791,7 +1791,17 @@ class Base(unittest2.TestCase):
else:
# 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
OpenPOWER on IntegriCloud