Skip to content

Commit

Permalink
Sleep-and-retry after a failure to delete a log file, which may be be…
Browse files Browse the repository at this point in the history
…cause antimalware is holding the handle to the just-created file.

Differential Revision: http://reviews.llvm.org/D12641

llvm-svn: 246870
  • Loading branch information
amccarth-google committed Sep 4, 2015
1 parent 2dcc235 commit a729204
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lldb/test/lldbtest.py
Expand Up @@ -1791,7 +1791,17 @@ def dumpSessionInfo(self):
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
Expand Down

0 comments on commit a729204

Please sign in to comment.