[Lldb-commits] [lldb] r226220 - During source manager test, write back the file using binary mode.

Zachary Turner zturner at google.com
Thu Jan 15 14:53:44 PST 2015


Author: zturner
Date: Thu Jan 15 16:53:44 2015
New Revision: 226220

URL: http://llvm.org/viewvc/llvm-project?rev=226220&view=rev
Log:
During source manager test, write back the file using binary mode.

On Windows, opening with "w" opens it as text instead of binary.
This causes translation of newline characters, so that "\n" turns
into "\r\n", which in turn leads to git detecting that the file
has changed and wanting to commit it.

Modified:
    lldb/trunk/test/source-manager/TestSourceManager.py

Modified: lldb/trunk/test/source-manager/TestSourceManager.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/source-manager/TestSourceManager.py?rev=226220&r1=226219&r2=226220&view=diff
==============================================================================
--- lldb/trunk/test/source-manager/TestSourceManager.py (original)
+++ lldb/trunk/test/source-manager/TestSourceManager.py Thu Jan 15 16:53:44 2015
@@ -155,7 +155,7 @@ class SourceManagerTestCase(TestBase):
         def restore_file():
             #print "os.path.getmtime() before restore:", os.path.getmtime('main.c')
             time.sleep(1)
-            with open('main.c', 'w') as f:
+            with open('main.c', 'wb') as f:
                 f.write(original_content)
             if self.TraceOn():
                 with open('main.c', 'r') as f:
@@ -168,7 +168,7 @@ class SourceManagerTestCase(TestBase):
 
 
         # Modify the source code file.
-        with open('main.c', 'w') as f:
+        with open('main.c', 'wb') as f:
             time.sleep(1)
             f.write(new_content)
             if self.TraceOn():





More information about the lldb-commits mailing list