summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/test/lldbtest.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py
index cc4abb3be1d..a64bb59fb32 100644
--- a/lldb/test/lldbtest.py
+++ b/lldb/test/lldbtest.py
@@ -1566,15 +1566,16 @@ class Base(unittest2.TestCase):
# keep all log files, rename them to include prefix
dst_log_basename = self.getLogBasenameForCurrentTest(prefix)
for src in log_files_for_this_test:
- dst = src.replace(self.log_basename, dst_log_basename)
- if os.name == "nt":
- # On Windows, renaming a -> b will throw an exception if b exists. On non-Windows platforms
- # it silently replaces the destination. Ultimately this means that atomic renames are not
- # guaranteed to be possible on Windows, but we need this to work anyway, so just remove the
- # destination first if it already exists.
- os.remove(dst)
-
- os.rename(src, dst)
+ if os.path.isfile(src):
+ dst = src.replace(self.log_basename, dst_log_basename)
+ if os.name == "nt" and os.path.isfile(dst):
+ # On Windows, renaming a -> b will throw an exception if b exists. On non-Windows platforms
+ # it silently replaces the destination. Ultimately this means that atomic renames are not
+ # guaranteed to be possible on Windows, but we need this to work anyway, so just remove the
+ # destination first if it already exists.
+ os.remove(dst)
+
+ os.rename(src, dst)
else:
# success! (and we don't want log files) delete log files
for log_file in log_files_for_this_test:
OpenPOWER on IntegriCloud