[Lldb-commits] [lldb] r286909 - Fix TestMiniDumpNew.py test for Python 2/3 issue
Adrian McCarthy via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 14 15:53:45 PST 2016
Author: amccarth
Date: Mon Nov 14 17:53:45 2016
New Revision: 286909
URL: http://llvm.org/viewvc/llvm-project?rev=286909&view=rev
Log:
Fix TestMiniDumpNew.py test for Python 2/3 issue
On Windows, where we use Python 3 for testing, we have to be more explicit about converting between binary and string representations. I believe this should still work for Python 2, but I don't have a convenient way to try it out.
Differential Revision: https://reviews.llvm.org/D26643
Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=286909&r1=286908&r2=286909&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py Mon Nov 14 17:53:45 2016
@@ -108,15 +108,16 @@ class MiniDumpNewTestCase(TestBase):
/proc/PID/status which is written in the file
"""
shutil.copyfile(core, newcore)
- with open(newcore, "r+") as f:
+ with open(newcore, "rb+") as f:
f.seek(offset)
- self.assertEqual(f.read(5), oldpid)
+ currentpid = f.read(5).decode('utf-8')
+ self.assertEqual(currentpid, oldpid)
f.seek(offset)
if len(newpid) < len(oldpid):
newpid += " " * (len(oldpid) - len(newpid))
newpid += "\n"
- f.write(newpid)
+ f.write(newpid.encode('utf-8'))
def test_deeper_stack_in_minidump_with_same_pid_running(self):
"""Test that we read the information from the core correctly even if we
More information about the lldb-commits
mailing list