Add from __future__ import print_function everywhere.
Apparently there were tons of instances I missed last time, I
guess I accidentally ran 2to3 non-recursively. This should be
every occurrence of a print statement fixed to use a print function
as well as from __future__ import print_function being added to
every file.
After this patch print statements will stop working everywhere in
the test suite, and the print function should be used instead.
llvm-svn: 251121
diff --git a/lldb/test/python_api/process/TestProcessAPI.py b/lldb/test/python_api/process/TestProcessAPI.py
index 15a70d1..e75b78c 100644
--- a/lldb/test/python_api/process/TestProcessAPI.py
+++ b/lldb/test/python_api/process/TestProcessAPI.py
@@ -2,6 +2,8 @@
Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others.
"""
+from __future__ import print_function
+
import lldb_shared
import os, time
@@ -50,7 +52,7 @@
if not error.Success():
self.fail("SBProcess.ReadMemory() failed")
if self.TraceOn():
- print "memory content:", content
+ print("memory content:", content)
self.expect(content, "Result from SBProcess.ReadMemory() matches our expected output: 'x'",
exe=False,
@@ -63,7 +65,7 @@
if not error.Success():
self.fail("SBProcess.ReadCStringFromMemory() failed")
if self.TraceOn():
- print "cstring read is:", cstring
+ print("cstring read is:", cstring)
self.expect(cstring, "Result from SBProcess.ReadCStringFromMemory() matches our expected output",
exe=False,
@@ -80,7 +82,7 @@
if not error.Success():
self.fail("SBProcess.ReadCStringFromMemory() failed")
if self.TraceOn():
- print "cstring read is:", cstring
+ print("cstring read is:", cstring)
self.expect(cstring, "Result from SBProcess.ReadCStringFromMemory() matches our expected output",
exe=False,
@@ -97,7 +99,7 @@
if not error.Success():
self.fail("SBProcess.ReadCStringFromMemory() failed")
if self.TraceOn():
- print "uint32 read is:", my_uint32
+ print("uint32 read is:", my_uint32)
if my_uint32 != 12345:
self.fail("Result from SBProcess.ReadUnsignedFromMemory() does not match our expected output")
@@ -148,7 +150,7 @@
if not error.Success():
self.fail("SBProcess.ReadMemory() failed")
if self.TraceOn():
- print "memory content:", content
+ print("memory content:", content)
self.expect(content, "Result from SBProcess.ReadMemory() matches our expected output: 'a'",
exe=False,
@@ -242,7 +244,7 @@
# Dump the memory content....
if self.TraceOn():
for i in new_bytes:
- print "byte:", i
+ print("byte:", i)
@python_api_test
def test_remote_launch(self):
@@ -257,7 +259,7 @@
process = target.LaunchSimple (None, None, self.get_process_working_directory())
if self.TraceOn():
- print "process state:", state_type_to_str(process.GetState())
+ print("process state:", state_type_to_str(process.GetState()))
self.assertTrue(process.GetState() != lldb.eStateConnected)
error = lldb.SBError()
@@ -283,4 +285,5 @@
error = lldb.SBError();
num = process.GetNumSupportedHardwareWatchpoints(error)
if self.TraceOn() and error.Success():
- print "Number of supported hardware watchpoints: %d" % num
+ print("Number of supported hardware watchpoints: %d" % num)
+
diff --git a/lldb/test/python_api/process/io/TestProcessIO.py b/lldb/test/python_api/process/io/TestProcessIO.py
index 1fce478..162003f 100644
--- a/lldb/test/python_api/process/io/TestProcessIO.py
+++ b/lldb/test/python_api/process/io/TestProcessIO.py
@@ -1,5 +1,7 @@
"""Test Python APIs for process IO."""
+from __future__ import print_function
+
import lldb_shared
import os, sys, time
@@ -164,7 +166,7 @@
self.assertTrue(self.process, PROCESS_IS_VALID)
if self.TraceOn():
- print "process launched."
+ print("process launched.")
# Frame #0 should be at our breakpoint.
threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, self.breakpoint)
@@ -175,7 +177,7 @@
self.assertTrue(self.frame, "Frame 0 is valid.")
if self.TraceOn():
- print "process stopped at breakpoint, sending STDIN via LLDB API."
+ print("process stopped at breakpoint, sending STDIN via LLDB API.")
# Write data to stdin via the public API if we were asked to
if put_stdin:
@@ -193,8 +195,8 @@
# once "input line=>1" appears in stdout.
# See also main.c.
if self.TraceOn():
- print "output = '%s'" % output
- print "error = '%s'" % error
+ print("output = '%s'" % output)
+ print("error = '%s'" % error)
for line in self.lines:
check_line = 'input line to stdout: %s' % (line)