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/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index 660f463..051063b 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -2,6 +2,8 @@
Test lldb breakpoint command add/list/delete.
"""
+from __future__ import print_function
+
import lldb_shared
import os, time
@@ -50,7 +52,7 @@
# Now add callbacks for the breakpoints just created.
self.runCmd("breakpoint command add -s command -o 'frame variable --show-types --scope' 1 4")
- self.runCmd("breakpoint command add -s python -o 'here = open(\"output.txt\", \"w\"); print >> here, \"lldb\"; here.close()' 2")
+ self.runCmd("breakpoint command add -s python -o 'here = open(\"output.txt\", \"w\"); print(\"lldb\", file=here); here.close()' 2")
self.runCmd("breakpoint command add --python-function bktptcmd.function 3")
# Check that the breakpoint commands are correctly set.
@@ -72,7 +74,7 @@
self.expect("breakpoint command list 2", "Breakpoint 2 command ok",
substrs = ["Breakpoint commands:",
"here = open",
- "print >> here",
+ "print(file=here)",
"here.close()"])
self.expect("breakpoint command list 3", "Breakpoint 3 command ok",
substrs = ["Breakpoint commands:",
@@ -176,7 +178,7 @@
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
# Now add callbacks for the breakpoints just created.
- self.runCmd("breakpoint command add -s python -o 'here = open(\"output-2.txt\", \"w\"); print >> here, frame; print >> here, bp_loc; here.close()' 1")
+ self.runCmd("breakpoint command add -s python -o 'here = open(\"output-2.txt\", \"w\"); print(frame, file=here); print(bp_loc, file=here); here.close()' 1")
# Remove 'output-2.txt' if it already exists.
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py b/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
index 0058bff..f9eb809 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
@@ -2,6 +2,8 @@
Test that you can set breakpoint commands successfully with the Python API's:
"""
+from __future__ import print_function
+
import lldb_shared
import os
@@ -49,7 +51,7 @@
got_one_in_B = False
for idx in range(0, num_locations):
comp_unit = no_files_bkpt.GetLocationAtIndex(idx).GetAddress().GetSymbolContext(lldb.eSymbolContextCompUnit).GetCompileUnit().GetFileSpec()
- print "Got comp unit: ", comp_unit.GetFilename()
+ print("Got comp unit: ", comp_unit.GetFilename())
if comp_unit.GetFilename() == "a.c":
got_one_in_A = True
elif comp_unit.GetFilename() == "b.c":
@@ -64,7 +66,7 @@
error = body_bkpt.SetScriptCallbackBody("\
import TestBreakpointCommandsFromPython\n\
TestBreakpointCommandsFromPython.PythonBreakpointCommandSettingTestCase.my_var = 20\n\
-print 'Hit breakpoint'")
+print('Hit breakpoint')")
self.assertTrue (error.Success(), "Failed to set the script callback body: %s."%(error.GetCString()))
self.dbg.HandleCommand("command script import --allow-reload ./bktptcmd.py")
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py b/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
index 2e2eac9..afc9f91 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
@@ -2,6 +2,8 @@
Test _regexp-break command which uses regular expression matching to dispatch to other built in breakpoint commands.
"""
+from __future__ import print_function
+
import lldb_shared
import os, time
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py b/lldb/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py
index 3018664..4bbb032 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py
@@ -1,4 +1,6 @@
+from __future__ import print_function
+
def function(frame, bp_loc, dict):
there = open("output2.txt", "w");
- print >> there, "lldb";
+ print("lldb", file=there)
there.close()