[Lldb-commits] [lldb] r250763 - Convert print statements to print function calls.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 19 16:45:41 PDT 2015


Author: zturner
Date: Mon Oct 19 18:45:41 2015
New Revision: 250763

URL: http://llvm.org/viewvc/llvm-project?rev=250763&view=rev
Log:
Convert print statements to print function calls.

This patch was generating by running `2to3` on the files in the
lldb/test directory.  This patch should be NFC, but it does
introduce the `from __future__ import print_function` line, which
will break future uses of the print statement.

Modified:
    lldb/trunk/test/bench.py
    lldb/trunk/test/curses_results.py
    lldb/trunk/test/dosep.py
    lldb/trunk/test/dotest.py
    lldb/trunk/test/dotest_args.py
    lldb/trunk/test/lldb_pylint_helper.py
    lldb/trunk/test/lldbinline.py
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/lldbutil.py
    lldb/trunk/test/progress.py
    lldb/trunk/test/redo.py

Modified: lldb/trunk/test/bench.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/bench.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/bench.py (original)
+++ lldb/trunk/test/bench.py Mon Oct 19 18:45:41 2015
@@ -14,6 +14,8 @@ Use the following to get only the benchm
 See also bench-history.
 """
 
+from __future__ import print_function
+
 import os, sys
 import re
 from optparse import OptionParser
@@ -55,17 +57,17 @@ Run the standard benchmarks defined in t
     # Parses the options, if any.
     opts, args = parser.parse_args()
                           
-    print "Starting bench runner...."
+    print("Starting bench runner....")
 
     for item in benches:
         command = item.replace('%E',
                                '-e "%s"' % opts.exe if opts.exe else '')
         command = command.replace('%X',
                                '-x "%s"' % opts.break_spec if opts.break_spec else '')
-        print "Running %s" % (command)
+        print("Running %s" % (command))
         os.system(command)
 
-    print "Bench runner done."
+    print("Bench runner done.")
 
 if __name__ == '__main__':
     main()

Modified: lldb/trunk/test/curses_results.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/curses_results.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/curses_results.py (original)
+++ lldb/trunk/test/curses_results.py Mon Oct 19 18:45:41 2015
@@ -9,6 +9,8 @@
 Configuration options for lldbtest.py set by dotest.py during initialization
 """
 
+from __future__ import print_function
+
 import curses
 import datetime
 import lldbcurses
@@ -43,7 +45,7 @@ class Curses(test_results.ResultsFormatt
             self.have_curses = False
             lldbcurses.terminate_curses()
             self.using_terminal = False
-            print "Unexpected error:", sys.exc_info()[0]
+            print("Unexpected error:", sys.exc_info()[0])
             raise
             
         

Modified: lldb/trunk/test/dosep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Mon Oct 19 18:45:41 2015
@@ -32,6 +32,8 @@ ulimit -c unlimited
 echo core.%p | sudo tee /proc/sys/kernel/core_pattern
 """
 
+from __future__ import print_function
+
 # system packages and modules
 import asyncore
 import distutils.version
@@ -104,10 +106,10 @@ def report_test_failure(name, command, o
     global output_lock
     with output_lock:
         if not (RESULTS_FORMATTER and RESULTS_FORMATTER.is_using_terminal()):
-            print >> sys.stderr
-            print >> sys.stderr, output
-            print >> sys.stderr, "[%s FAILED]" % name
-            print >> sys.stderr, "Command invoked: %s" % ' '.join(command)
+            print(file=sys.stderr)
+            print(output, file=sys.stderr)
+            print("[%s FAILED]" % name, file=sys.stderr)
+            print("Command invoked: %s" % ' '.join(command), file=sys.stderr)
         update_progress(name)
 
 
@@ -116,9 +118,9 @@ def report_test_pass(name, output):
     with output_lock:
         if not (RESULTS_FORMATTER and RESULTS_FORMATTER.is_using_terminal()):
             if output_on_success:
-                print >> sys.stderr
-                print >> sys.stderr, output
-                print >> sys.stderr, "[%s PASSED]" % name
+                print(file=sys.stderr)
+                print(output, file=sys.stderr)
+                print("[%s PASSED]" % name, file=sys.stderr)
         update_progress(name)
 
 
@@ -414,7 +416,7 @@ def kill_all_worker_processes(workers, i
     active_pid_set = collect_active_pids_from_pid_events(
         inferior_pid_events)
     for inferior_pid in active_pid_set:
-        print "killing inferior pid {}".format(inferior_pid)
+        print("killing inferior pid {}".format(inferior_pid))
         os.kill(inferior_pid, signal.SIGKILL)
 
 
@@ -432,7 +434,7 @@ def kill_all_worker_threads(workers, inf
     active_pid_set = collect_active_pids_from_pid_events(
         inferior_pid_events)
     for inferior_pid in active_pid_set:
-        print "killing inferior pid {}".format(inferior_pid)
+        print("killing inferior pid {}".format(inferior_pid))
         os.kill(inferior_pid, signal.SIGKILL)
 
     # We don't have a way to nuke the threads.  However, since we killed
@@ -485,8 +487,8 @@ def initialize_global_vars_common(num_th
     test_counter = multiprocessing.Value('i', 0)
     test_name_len = multiprocessing.Value('i', 0)
     if not (RESULTS_FORMATTER and RESULTS_FORMATTER.is_using_terminal()):
-        print >> sys.stderr, "Testing: %d test suites, %d thread%s" % (
-            total_tests, num_threads, (num_threads > 1) * "s")
+        print("Testing: %d test suites, %d thread%s" % (
+            total_tests, num_threads, (num_threads > 1) * "s"), file=sys.stderr)
     update_progress()
 
 
@@ -630,7 +632,7 @@ def handle_ctrl_c(ctrl_c_count, job_queu
         name_index = len(key_name) - 1
     message = "\nHandling {} KeyboardInterrupt".format(key_name[name_index])
     with output_lock:
-        print message
+        print(message)
 
     if ctrl_c_count == 1:
         # Remove all outstanding items from the work queue so we stop
@@ -642,13 +644,13 @@ def handle_ctrl_c(ctrl_c_count, job_queu
             except Queue.Empty:
                 pass
         with output_lock:
-            print "Stopped more work from being started."
+            print("Stopped more work from being started.")
     elif ctrl_c_count == 2:
         # Try to stop all inferiors, even the ones currently doing work.
         stop_all_inferiors_func(workers, inferior_pid_events)
     else:
         with output_lock:
-            print "All teardown activities kicked off, should finish soon."
+            print("All teardown activities kicked off, should finish soon.")
 
 
 def workers_and_async_done(workers, async_map):
@@ -1392,33 +1394,33 @@ def main(print_details_on_success, num_t
             test_name = os.path.splitext(xtime)[0]
             touch(os.path.join(session_dir, "{}-{}".format(result, test_name)))
 
-    print
+    print()
     sys.stdout.write("Ran %d test suites" % num_test_files)
     if num_test_files > 0:
         sys.stdout.write(" (%d failed) (%f%%)" % (
             len(failed), 100.0 * len(failed) / num_test_files))
-    print
+    print()
     sys.stdout.write("Ran %d test cases" % num_test_cases)
     if num_test_cases > 0:
         sys.stdout.write(" (%d failed) (%f%%)" % (
             fail_count, 100.0 * fail_count / num_test_cases))
-    print
+    print()
     exit_code = 0
 
     if len(failed) > 0:
         failed.sort()
-        print "Failing Tests (%d)" % len(failed)
+        print("Failing Tests (%d)" % len(failed))
         for f in failed:
-            print "%s: LLDB (suite) :: %s (%s)" % (
+            print("%s: LLDB (suite) :: %s (%s)" % (
                 "TIMEOUT" if f in timed_out else "FAIL", f, system_info
-            )
+            ))
         exit_code = 1
 
     if len(unexpected_successes) > 0:
         unexpected_successes.sort()
-        print "\nUnexpected Successes (%d)" % len(unexpected_successes)
+        print("\nUnexpected Successes (%d)" % len(unexpected_successes))
         for u in unexpected_successes:
-            print "UNEXPECTED SUCCESS: LLDB (suite) :: %s (%s)" % (u, system_info)
+            print("UNEXPECTED SUCCESS: LLDB (suite) :: %s (%s)" % (u, system_info))
 
     sys.exit(exit_code)
 

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Mon Oct 19 18:45:41 2015
@@ -20,6 +20,8 @@ Type:
 for available options.
 """
 
+from __future__ import print_function
+
 import atexit
 import commands
 import importlib
@@ -272,7 +274,7 @@ all_tests = set()
 def usage(parser):
     parser.print_help()
     if verbose > 0:
-        print """
+        print("""
 Examples:
 
 This is an example of using the -f option to pinpoint to a specific test class
@@ -380,7 +382,7 @@ o GDB_REMOTE_LOG: if defined, specifies
   'process.gdb-remote' subsystem with a default option of 'packets' if
   GDB_REMOTE_LOG_OPTION is not defined.
 
-"""
+""")
     sys.exit(0)
 
 
@@ -406,9 +408,9 @@ def validate_categories(categories):
         if category not in validCategories:
             category = unique_string_match(category, validCategories)
         if (category not in validCategories) or category == None:
-            print "fatal error: category '" + origCategory + "' is not a valid category"
-            print "if you have added a new category, please edit dotest.py, adding your new category to validCategories"
-            print "else, please specify one or more of the following: " + str(validCategories.keys())
+            print("fatal error: category '" + origCategory + "' is not a valid category")
+            print("if you have added a new category, please edit dotest.py, adding your new category to validCategories")
+            print("else, please specify one or more of the following: " + str(validCategories.keys()))
             sys.exit(1)
         result.append(category)
     return result
@@ -547,7 +549,7 @@ def parseOptionsAndInitTestdirs():
 
     # only print the args if being verbose (and parsable is off)
     if args.v and not args.q:
-        print sys.argv
+        print(sys.argv)
 
     if args.h:
         do_help = True
@@ -615,7 +617,7 @@ def parseOptionsAndInitTestdirs():
 
     if args.plus_a:
         if dont_do_python_api_test:
-            print "Warning: -a and +a can't both be specified! Using only -a"
+            print("Warning: -a and +a can't both be specified! Using only -a")
         else:
             just_do_python_api_test = True
 
@@ -627,7 +629,7 @@ def parseOptionsAndInitTestdirs():
             usage(parser)
         blacklistFile = args.b
         if not os.path.isfile(blacklistFile):
-            print 'Blacklist file:', blacklistFile, 'does not exist!'
+            print('Blacklist file:', blacklistFile, 'does not exist!')
             usage(parser)
         # Now read the blacklist contents and assign it to blacklist.
         execfile(blacklistFile, globals(), blacklistConfig)
@@ -638,7 +640,7 @@ def parseOptionsAndInitTestdirs():
             usage(parser)
         configFile = args.c
         if not os.path.isfile(configFile):
-            print 'Config file:', configFile, 'does not exist!'
+            print('Config file:', configFile, 'does not exist!')
             usage(parser)
 
     if args.d:
@@ -689,7 +691,7 @@ def parseOptionsAndInitTestdirs():
 
     if args.plus_m:
         if dont_do_lldbmi_test:
-            print "Warning: -m and +m can't both be specified! Using only -m"
+            print("Warning: -m and +m can't both be specified! Using only -m")
         else:
             just_do_lldbmi_test = True
 
@@ -724,7 +726,7 @@ def parseOptionsAndInitTestdirs():
         rdir = os.path.abspath(args.R)
         if os.path.exists(rdir):
             import shutil
-            print 'Removing tree:', rdir
+            print('Removing tree:', rdir)
             shutil.rmtree(rdir)
 
     if args.r:
@@ -732,7 +734,7 @@ def parseOptionsAndInitTestdirs():
             usage(parser)
         rdir = os.path.abspath(args.r)
         if os.path.exists(rdir):
-            print 'Relocated directory:', rdir, 'must not exist!'
+            print('Relocated directory:', rdir, 'must not exist!')
             usage(parser)
 
     if args.S:
@@ -918,12 +920,12 @@ def parseOptionsAndInitTestdirs():
         if "pre_flight" in config:
             pre_flight = config["pre_flight"]
             if not callable(pre_flight):
-                print "fatal error: pre_flight is not callable, exiting."
+                print("fatal error: pre_flight is not callable, exiting.")
                 sys.exit(1)
         if "post_flight" in config:
             post_flight = config["post_flight"]
             if not callable(post_flight):
-                print "fatal error: post_flight is not callable, exiting."
+                print("fatal error: post_flight is not callable, exiting.")
                 sys.exit(1)
         if "lldbtest_remote_sandbox" in config:
             lldbtest_remote_sandbox = config["lldbtest_remote_sandbox"]
@@ -1091,7 +1093,7 @@ def setupSysPath():
     else:
         scriptPath = os.path.dirname(os.path.realpath(__file__))
     if not scriptPath.endswith('test'):
-        print "This script expects to reside in lldb's test directory."
+        print("This script expects to reside in lldb's test directory.")
         sys.exit(-1)
 
     if rdir:
@@ -1157,11 +1159,11 @@ def setupSysPath():
         lldbtest_config.lldbExec = which('lldb')
 
     if lldbtest_config.lldbExec and not is_exe(lldbtest_config.lldbExec):
-        print "'{}' is not a path to a valid executable".format(lldbtest_config.lldbExec)
+        print("'{}' is not a path to a valid executable".format(lldbtest_config.lldbExec))
         lldbtest_config.lldbExec = None
 
     if not lldbtest_config.lldbExec:
-        print "The 'lldb' executable cannot be located.  Some of the tests may not be run as a result."
+        print("The 'lldb' executable cannot be located.  Some of the tests may not be run as a result.")
         sys.exit(-1)
 
     lldbLibDir = os.path.dirname(lldbtest_config.lldbExec)  # confusingly, this is the "bin" directory
@@ -1169,8 +1171,8 @@ def setupSysPath():
     lldbImpLibDir = os.path.join(lldbLibDir, '..', 'lib') if sys.platform.startswith('win32') else lldbLibDir
     os.environ["LLDB_IMPLIB_DIR"] = lldbImpLibDir
     if not noHeaders:
-        print "LLDB library dir:", os.environ["LLDB_LIB_DIR"]
-        print "LLDB import library dir:", os.environ["LLDB_IMPLIB_DIR"]
+        print("LLDB library dir:", os.environ["LLDB_LIB_DIR"])
+        print("LLDB import library dir:", os.environ["LLDB_IMPLIB_DIR"])
         os.system('%s -v' % lldbtest_config.lldbExec)
 
     # Assume lldb-mi is in same place as lldb
@@ -1181,9 +1183,9 @@ def setupSysPath():
     if not lldbMiExec:
         dont_do_lldbmi_test = True
         if just_do_lldbmi_test:
-            print "The 'lldb-mi' executable cannot be located.  The lldb-mi tests can not be run as a result."
+            print("The 'lldb-mi' executable cannot be located.  The lldb-mi tests can not be run as a result.")
         else:
-            print "The 'lldb-mi' executable cannot be located.  Some of the tests may not be run as a result."
+            print("The 'lldb-mi' executable cannot be located.  Some of the tests may not be run as a result.")
     else:
         os.environ["LLDBMI_EXEC"] = lldbMiExec
 
@@ -1196,7 +1198,7 @@ def setupSysPath():
             pipe = subprocess.Popen([which("git"), "svn", "info", lldbRootDirectory], stdout = subprocess.PIPE)
             svn_info = pipe.stdout.read()
         if not noHeaders:
-            print svn_info
+            print(svn_info)
 
     global ignore
 
@@ -1206,7 +1208,7 @@ def setupSysPath():
         if os.path.isfile(os.path.join(candidatePath, 'lldb/__init__.py')):
             lldbPythonDir = candidatePath
         if not lldbPythonDir:
-            print 'Resources/Python/lldb/__init__.py was not found in ' + lldbFrameworkPath
+            print('Resources/Python/lldb/__init__.py was not found in ' + lldbFrameworkPath)
             sys.exit(-1)
     else:
         # The '-i' option is used to skip looking for lldb.py in the build tree.
@@ -1252,19 +1254,19 @@ def setupSysPath():
                         break
 
                 if not lldbPythonDir:
-                    print 'This script requires lldb.py to be in either ' + dbgPath + ',',
-                    print relPath + ', or ' + baiPath + '. Some tests might fail.'
+                    print('This script requires lldb.py to be in either ' + dbgPath + ',', end=' ')
+                    print(relPath + ', or ' + baiPath + '. Some tests might fail.')
             else:
-                print "Unable to load lldb extension module.  Possible reasons for this include:"
-                print "  1) LLDB was built with LLDB_DISABLE_PYTHON=1"
-                print "  2) PYTHONPATH and PYTHONHOME are not set correctly.  PYTHONHOME should refer to"
-                print "     the version of Python that LLDB built and linked against, and PYTHONPATH"
-                print "     should contain the Lib directory for the same python distro, as well as the"
-                print "     location of LLDB\'s site-packages folder."
-                print "  3) A different version of Python than that which was built against is exported in"
-                print "     the system\'s PATH environment variable, causing conflicts."
-                print "  4) The executable '%s' could not be found.  Please check " % lldbExecutable
-                print "     that it exists and is executable."
+                print("Unable to load lldb extension module.  Possible reasons for this include:")
+                print("  1) LLDB was built with LLDB_DISABLE_PYTHON=1")
+                print("  2) PYTHONPATH and PYTHONHOME are not set correctly.  PYTHONHOME should refer to")
+                print("     the version of Python that LLDB built and linked against, and PYTHONPATH")
+                print("     should contain the Lib directory for the same python distro, as well as the")
+                print("     location of LLDB\'s site-packages folder.")
+                print("  3) A different version of Python than that which was built against is exported in")
+                print("     the system\'s PATH environment variable, causing conflicts.")
+                print("  4) The executable '%s' could not be found.  Please check " % lldbExecutable)
+                print("     that it exists and is executable.")
 
     if lldbPythonDir:
         lldbPythonDir = os.path.normpath(lldbPythonDir)
@@ -1282,7 +1284,7 @@ def setupSysPath():
         # This is to locate the lldb.py module.  Insert it right after sys.path[0].
         sys.path[1:1] = [lldbPythonDir]
         if dumpSysPath:
-            print "sys.path:", sys.path
+            print("sys.path:", sys.path)
 
 def visit(prefix, dir, names):
     """Visitor function for os.path.walk(path, visit, arg)."""
@@ -1428,10 +1430,10 @@ def checkDsymForUUIDIsNotOn():
     pipe = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
     cmd_output = pipe.stdout.read()
     if cmd_output and "DBGFileMappedPaths = " in cmd_output:
-        print "%s =>" % ' '.join(cmd)
-        print cmd_output
-        print "Disable automatic lookup and caching of dSYMs before running the test suite!"
-        print "Exiting..."
+        print("%s =>" % ' '.join(cmd))
+        print(cmd_output)
+        print("Disable automatic lookup and caching of dSYMs before running the test suite!")
+        print("Exiting...")
         sys.exit(0)
 
 def exitTestSuite(exitCode = None):
@@ -1491,27 +1493,27 @@ if __name__ == "__main__":
     lldb.DBG = lldb.SBDebugger.Create()
 
     if lldb_platform_name:
-        print "Setting up remote platform '%s'" % (lldb_platform_name)
+        print("Setting up remote platform '%s'" % (lldb_platform_name))
         lldb.remote_platform = lldb.SBPlatform(lldb_platform_name)
         if not lldb.remote_platform.IsValid():
-            print "error: unable to create the LLDB platform named '%s'." % (lldb_platform_name)
+            print("error: unable to create the LLDB platform named '%s'." % (lldb_platform_name))
             exitTestSuite(1)
         if lldb_platform_url:
             # We must connect to a remote platform if a LLDB platform URL was specified
-            print "Connecting to remote platform '%s' at '%s'..." % (lldb_platform_name, lldb_platform_url)
+            print("Connecting to remote platform '%s' at '%s'..." % (lldb_platform_name, lldb_platform_url))
             lldb.platform_url = lldb_platform_url
             platform_connect_options = lldb.SBPlatformConnectOptions(lldb_platform_url)
             err = lldb.remote_platform.ConnectRemote(platform_connect_options)
             if err.Success():
-                print "Connected."
+                print("Connected.")
             else:
-                print "error: failed to connect to remote platform using URL '%s': %s" % (lldb_platform_url, err)
+                print("error: failed to connect to remote platform using URL '%s': %s" % (lldb_platform_url, err))
                 exitTestSuite(1)
         else:
             lldb.platform_url = None
 
         if lldb_platform_working_dir:
-            print "Setting remote platform working directory to '%s'..." % (lldb_platform_working_dir)
+            print("Setting remote platform working directory to '%s'..." % (lldb_platform_working_dir))
             lldb.remote_platform.SetWorkingDirectory(lldb_platform_working_dir)
     
         lldb.remote_platform_working_dir = lldb_platform_working_dir
@@ -1564,8 +1566,8 @@ if __name__ == "__main__":
             return repr(obj)
 
     if not noHeaders:
-        print "lldb.pre_flight:", getsource_if_available(lldb.pre_flight)
-        print "lldb.post_flight:", getsource_if_available(lldb.post_flight)
+        print("lldb.pre_flight:", getsource_if_available(lldb.pre_flight))
+        print("lldb.post_flight:", getsource_if_available(lldb.post_flight))
 
     # If either pre_flight or post_flight is defined, set lldb.test_remote to True.
     if lldb.pre_flight or lldb.post_flight:
@@ -1637,9 +1639,9 @@ if __name__ == "__main__":
     where_to_save_session = os.getcwd()
     fname = os.path.join(sdir_name, "TestStarted-%d" % os.getpid())
     with open(fname, "w") as f:
-        print >> f, "Test started at: %s\n" % timestamp_started
-        print >> f, svn_info
-        print >> f, "Command invoked: %s\n" % getMyCommandLine()
+        print("Test started at: %s\n" % timestamp_started, file=f)
+        print(svn_info, file=f)
+        print("Command invoked: %s\n" % getMyCommandLine(), file=f)
 
     #
     # Invoke the default TextTestRunner to run the test suite, possibly iterating
@@ -1671,17 +1673,17 @@ if __name__ == "__main__":
                 cmd_output = pipe.stdout.read()
                 if cmd_output:
                     if "not found" in cmd_output:
-                        print "dropping %s from the compilers used" % c
+                        print("dropping %s from the compilers used" % c)
                         compilers.remove(i)
                     else:
                         compilers[i] = cmd_output.split('\n')[0]
-                        print "'xcrun -find %s' returning %s" % (c, compilers[i])
+                        print("'xcrun -find %s' returning %s" % (c, compilers[i]))
 
     if not parsable:
-        print "compilers=%s" % str(compilers)
+        print("compilers=%s" % str(compilers))
 
     if not compilers or len(compilers) == 0:
-        print "No eligible compiler found, exiting."
+        print("No eligible compiler found, exiting.")
         exitTestSuite(1)
 
     if isinstance(compilers, list) and len(compilers) >= 1:
@@ -2055,12 +2057,12 @@ if __name__ == "__main__":
     os.chdir(where_to_save_session)
     fname = os.path.join(sdir_name, "TestFinished-%d" % os.getpid())
     with open(fname, "w") as f:
-        print >> f, "Test finished at: %s\n" % datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S")
+        print("Test finished at: %s\n" % datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S"), file=f)
 
     # Terminate the test suite if ${LLDB_TESTSUITE_FORCE_FINISH} is defined.
     # This should not be necessary now.
     if ("LLDB_TESTSUITE_FORCE_FINISH" in os.environ):
-        print "Terminating Test suite..."
+        print("Terminating Test suite...")
         subprocess.Popen(["/bin/sh", "-c", "kill %s; exit 0" % (os.getpid())])
 
     # Exiting.

Modified: lldb/trunk/test/dotest_args.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest_args.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/dotest_args.py (original)
+++ lldb/trunk/test/dotest_args.py Mon Oct 19 18:45:41 2015
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 import sys
 import multiprocessing
 import os
@@ -20,7 +22,7 @@ def parse_args(parser, argv):
         args = ArgParseNamespace()
 
         if ('LLDB_TEST_ARGUMENTS' in os.environ):
-            print "Arguments passed through environment: '%s'" % os.environ['LLDB_TEST_ARGUMENTS']
+            print("Arguments passed through environment: '%s'" % os.environ['LLDB_TEST_ARGUMENTS'])
             args = parser.parse_args([sys.argv[0]].__add__(os.environ['LLDB_TEST_ARGUMENTS'].split()),namespace=args)
 
         return parser.parse_args(args=argv, namespace=args)

Modified: lldb/trunk/test/lldb_pylint_helper.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldb_pylint_helper.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/lldb_pylint_helper.py (original)
+++ lldb/trunk/test/lldb_pylint_helper.py Mon Oct 19 18:45:41 2015
@@ -11,6 +11,9 @@ and multiple OS types, verifying changes
 
 Provides helper support for adding lldb test paths to the python path.
 """
+
+from __future__ import print_function
+
 import os
 import platform
 import subprocess
@@ -125,7 +128,7 @@ def add_lldb_module_directory():
             sys.path.insert(0, lldb_module_path)
     # pylint: disable=broad-except
     except Exception as exception:
-        print "failed to find python path: {}".format(exception)
+        print("failed to find python path: {}".format(exception))
 
 
 def add_lldb_test_package_paths(check_dir):

Modified: lldb/trunk/test/lldbinline.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbinline.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/lldbinline.py (original)
+++ lldb/trunk/test/lldbinline.py Mon Oct 19 18:45:41 2015
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 import lldb
 from lldbtest import *
 import lldbutil
@@ -161,8 +163,8 @@ class InlineTest(TestBase):
         value = self.frame().EvaluateExpression (expression)
         self.assertTrue(value.IsValid(), expression+"returned a valid value")
         if self.TraceOn():
-            print value.GetSummary()
-            print value.GetValue()
+            print(value.GetSummary())
+            print(value.GetValue())
         if use_summary:
             answer = value.GetSummary()
         else:

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Oct 19 18:45:41 2015
@@ -31,6 +31,8 @@ OK
 $ 
 """
 
+from __future__ import print_function
+
 import abc
 import gc
 import glob
@@ -247,9 +249,9 @@ class recording(StringIO.StringIO):
         recordings to our session object.  And close the StringIO object, too.
         """
         if self.trace:
-            print >> sys.stderr, self.getvalue()
+            print(self.getvalue(), file=sys.stderr)
         if self.session:
-            print >> self.session, self.getvalue()
+            print(self.getvalue(), file=self.session)
         self.close()
 
 class _BaseProcess(object):
@@ -390,13 +392,13 @@ def system(commands, **kwargs):
             trace = True
 
         with recording(test, trace) as sbuf:
-            print >> sbuf
-            print >> sbuf, "os command:", shellCommand
-            print >> sbuf, "with pid:", pid
-            print >> sbuf, "stdout:", this_output
-            print >> sbuf, "stderr:", this_error
-            print >> sbuf, "retcode:", retcode
-            print >> sbuf
+            print(file=sbuf)
+            print("os command:", shellCommand, file=sbuf)
+            print("with pid:", pid, file=sbuf)
+            print("stdout:", this_output, file=sbuf)
+            print("stderr:", this_error, file=sbuf)
+            print("retcode:", retcode, file=sbuf)
+            print(file=sbuf)
 
         if retcode:
             cmd = kwargs.get("args")
@@ -1235,7 +1237,7 @@ class Base(unittest2.TestCase):
         if ("LLDB_TEST" in os.environ):
             full_dir = os.path.join(os.environ["LLDB_TEST"], cls.mydir)
             if traceAlways:
-                print >> sys.stderr, "Change dir to:", full_dir
+                print("Change dir to:", full_dir, file=sys.stderr)
             os.chdir(os.path.join(os.environ["LLDB_TEST"], cls.mydir))
 
         if debug_confirm_directory_exclusivity:
@@ -1251,7 +1253,7 @@ class Base(unittest2.TestCase):
                 cls.dir_lock.acquire()
                 # read the previous owner from the lock file
                 lock_id = cls.dir_lock.handle.read()
-                print >> sys.stderr, "LOCK ERROR: {} wants to lock '{}' but it is already locked by '{}'".format(cls.__name__, full_dir, lock_id)
+                print("LOCK ERROR: {} wants to lock '{}' but it is already locked by '{}'".format(cls.__name__, full_dir, lock_id), file=sys.stderr)
                 raise ioerror
 
         # Set platform context.
@@ -1277,7 +1279,7 @@ class Base(unittest2.TestCase):
             # Subclass might have specific cleanup function defined.
             if getattr(cls, "classCleanup", None):
                 if traceAlways:
-                    print >> sys.stderr, "Call class-specific cleanup function for class:", cls
+                    print("Call class-specific cleanup function for class:", cls, file=sys.stderr)
                 try:
                     cls.classCleanup()
                 except:
@@ -1290,7 +1292,7 @@ class Base(unittest2.TestCase):
 
         # Restore old working directory.
         if traceAlways:
-            print >> sys.stderr, "Restore dir to:", cls.oldcwd
+            print("Restore dir to:", cls.oldcwd, file=sys.stderr)
         os.chdir(cls.oldcwd)
 
     @classmethod
@@ -1626,7 +1628,7 @@ class Base(unittest2.TestCase):
         """
         if callable(hook):
             with recording(self, traceAlways) as sbuf:
-                print >> sbuf, "Adding tearDown hook:", getsource_if_available(hook)
+                print("Adding tearDown hook:", getsource_if_available(hook), file=sbuf)
             self.hooks.append(hook)
         
         return self
@@ -1637,7 +1639,7 @@ class Base(unittest2.TestCase):
         if self.child and self.child.isalive():
             import pexpect
             with recording(self, traceAlways) as sbuf:
-                print >> sbuf, "tearing down the child process...."
+                print("tearing down the child process....", file=sbuf)
             try:
                 if self.child_in_script_interpreter:
                     self.child.sendline('quit()')
@@ -1669,7 +1671,7 @@ class Base(unittest2.TestCase):
         # Check and run any hook functions.
         for hook in reversed(self.hooks):
             with recording(self, traceAlways) as sbuf:
-                print >> sbuf, "Executing tearDown hook:", getsource_if_available(hook)
+                print("Executing tearDown hook:", getsource_if_available(hook), file=sbuf)
             import inspect
             hook_argc = len(inspect.getargspec(hook).args)
             if hook_argc == 0 or getattr(hook,'im_self',None):
@@ -1703,7 +1705,7 @@ class Base(unittest2.TestCase):
         with recording(self, False) as sbuf:
             # False because there's no need to write "ERROR" to the stderr twice.
             # Once by the Python unittest framework, and a second time by us.
-            print >> sbuf, "ERROR"
+            print("ERROR", file=sbuf)
 
     def markCleanupError(self):
         """Callback invoked when an error occurs while a test is cleaning up."""
@@ -1711,7 +1713,7 @@ class Base(unittest2.TestCase):
         with recording(self, False) as sbuf:
             # False because there's no need to write "CLEANUP_ERROR" to the stderr twice.
             # Once by the Python unittest framework, and a second time by us.
-            print >> sbuf, "CLEANUP_ERROR"
+            print("CLEANUP_ERROR", file=sbuf)
 
     def markFailure(self):
         """Callback invoked when a failure (test assertion failure) occurred."""
@@ -1719,7 +1721,7 @@ class Base(unittest2.TestCase):
         with recording(self, False) as sbuf:
             # False because there's no need to write "FAIL" to the stderr twice.
             # Once by the Python unittest framework, and a second time by us.
-            print >> sbuf, "FAIL"
+            print("FAIL", file=sbuf)
 
     def markExpectedFailure(self,err,bugnumber):
         """Callback invoked when an expected failure/error occurred."""
@@ -1729,9 +1731,9 @@ class Base(unittest2.TestCase):
             # stderr twice.
             # Once by the Python unittest framework, and a second time by us.
             if bugnumber == None:
-                print >> sbuf, "expected failure"
+                print("expected failure", file=sbuf)
             else:
-                print >> sbuf, "expected failure (problem id:" + str(bugnumber) + ")"
+                print("expected failure (problem id:" + str(bugnumber) + ")", file=sbuf)
 
     def markSkippedTest(self):
         """Callback invoked when a test is skipped."""
@@ -1740,7 +1742,7 @@ class Base(unittest2.TestCase):
             # False because there's no need to write "skipped test" to the
             # stderr twice.
             # Once by the Python unittest framework, and a second time by us.
-            print >> sbuf, "skipped test"
+            print("skipped test", file=sbuf)
 
     def markUnexpectedSuccess(self, bugnumber):
         """Callback invoked when an unexpected success occurred."""
@@ -1750,9 +1752,9 @@ class Base(unittest2.TestCase):
             # stderr twice.
             # Once by the Python unittest framework, and a second time by us.
             if bugnumber == None:
-                print >> sbuf, "unexpected success"
+                print("unexpected success", file=sbuf)
             else:
-                print >> sbuf, "unexpected success (problem id:" + str(bugnumber) + ")"
+                print("unexpected success (problem id:" + str(bugnumber) + ")", file=sbuf)
 
     def getRerunArgs(self):
         return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)
@@ -1830,7 +1832,7 @@ class Base(unittest2.TestCase):
         if not self.__unexpected__ and not self.__skipped__:
             for test, traceback in pairs:
                 if test is self:
-                    print >> self.session, traceback
+                    print(traceback, file=self.session)
 
         # put footer (timestamp/rerun instructions) into session
         testMethod = getattr(self, self._testMethodName)
@@ -1840,11 +1842,11 @@ class Base(unittest2.TestCase):
             benchmarks = False
 
         import datetime
-        print >> self.session, "Session info generated @", datetime.datetime.now().ctime()
-        print >> self.session, "To rerun this test, issue the following command from the 'test' directory:\n"
-        print >> self.session, "./dotest.py %s -v %s %s" % (self.getRunOptions(),
+        print("Session info generated @", datetime.datetime.now().ctime(), file=self.session)
+        print("To rerun this test, issue the following command from the 'test' directory:\n", file=self.session)
+        print("./dotest.py %s -v %s %s" % (self.getRunOptions(),
                                                  ('+b' if benchmarks else '-t'),
-                                                 self.getRerunArgs())
+                                                 self.getRerunArgs()), file=self.session)
         self.session.close()
         del self.session
 
@@ -2072,7 +2074,7 @@ class Base(unittest2.TestCase):
                  'CFLAGS_EXTRAS' : "%s %s -I%s" % (stdflag, stdlibflag, os.path.join(os.environ["LLDB_SRC"], "include")),
                  'LD_EXTRAS' : "-L%s -lliblldb" % self.implib_dir}
         if self.TraceOn():
-            print "Building LLDB Driver (%s) from sources %s" % (exe_name, sources)
+            print("Building LLDB Driver (%s) from sources %s" % (exe_name, sources))
 
         self.buildDefault(dictionary=d)
 
@@ -2100,7 +2102,7 @@ class Base(unittest2.TestCase):
                  'CFLAGS_EXTRAS' : "%s -I%s -fPIC" % (stdflag, os.path.join(os.environ["LLDB_SRC"], "include")),
                  'LD_EXTRAS' : "-shared -l%s\liblldb.lib" % self.implib_dir}
         if self.TraceOn():
-            print "Building LLDB Library (%s) from sources %s" % (lib_name, sources)
+            print("Building LLDB Library (%s) from sources %s" % (lib_name, sources))
 
         self.buildDefault(dictionary=d)
     
@@ -2423,7 +2425,7 @@ class TestBase(Base):
                 return target
             self.dbg.CreateTarget = DecoratedCreateTarget
             if self.TraceOn():
-                print "self.dbg.Create is redefined to:\n%s" % getsource_if_available(DecoratedCreateTarget)
+                print("self.dbg.Create is redefined to:\n%s" % getsource_if_available(DecoratedCreateTarget))
 
         # We want our debugger to be synchronous.
         self.dbg.SetAsync(False)
@@ -2462,7 +2464,7 @@ class TestBase(Base):
                     lldb.remote_platform.Run(shell_cmd)
                 self.addTearDownHook(clean_working_directory)
             else:
-                print "error: making remote directory '%s': %s" % (remote_test_dir, error)
+                print("error: making remote directory '%s': %s" % (remote_test_dir, error))
     
     def registerSharedLibrariesWithTarget(self, target, shlibs):
         '''If we are remotely running the test suite, register the shared libraries with the target so they get uploaded, otherwise do nothing
@@ -2618,11 +2620,11 @@ class TestBase(Base):
                 target = atoms[-1]
                 # Now let's get the absolute pathname of our target.
                 abs_target = os.path.abspath(target)
-                print >> sbuf, "Found a file command, target (with absolute pathname)=%s" % abs_target
+                print("Found a file command, target (with absolute pathname)=%s" % abs_target, file=sbuf)
                 fpath, fname = os.path.split(abs_target)
                 parent_dir = os.path.split(fpath)[0]
                 platform_target_install_command = 'platform target-install %s %s' % (fpath, lldb.lldbtest_remote_sandbox)
-                print >> sbuf, "Insert this command to be run first: %s" % platform_target_install_command
+                print("Insert this command to be run first: %s" % platform_target_install_command, file=sbuf)
                 self.ci.HandleCommand(platform_target_install_command, self.res)
                 # And this is the file command we want to execute, instead.
                 #
@@ -2632,7 +2634,7 @@ class TestBase(Base):
                 #
                 lldb.lldbtest_remote_sandboxed_executable = abs_target.replace(parent_dir, lldb.lldbtest_remote_sandbox)
                 cmd = "file -P %s %s %s" % (lldb.lldbtest_remote_sandboxed_executable, the_rest.replace(target, ''), abs_target)
-                print >> sbuf, "And this is the replaced file command: %s" % cmd
+                print("And this is the replaced file command: %s" % cmd, file=sbuf)
 
         running = (cmd.startswith("run") or cmd.startswith("process launch"))
 
@@ -2640,14 +2642,14 @@ class TestBase(Base):
             self.ci.HandleCommand(cmd, self.res, inHistory)
 
             with recording(self, trace) as sbuf:
-                print >> sbuf, "runCmd:", cmd
+                print("runCmd:", cmd, file=sbuf)
                 if not check:
-                    print >> sbuf, "check of return status not required"
+                    print("check of return status not required", file=sbuf)
                 if self.res.Succeeded():
-                    print >> sbuf, "output:", self.res.GetOutput()
+                    print("output:", self.res.GetOutput(), file=sbuf)
                 else:
-                    print >> sbuf, "runCmd failed!"
-                    print >> sbuf, self.res.GetError()
+                    print("runCmd failed!", file=sbuf)
+                    print(self.res.GetError(), file=sbuf)
 
             if self.res.Succeeded():
                 break
@@ -2655,7 +2657,7 @@ class TestBase(Base):
                 # For process launch, wait some time before possible next try.
                 time.sleep(self.timeWaitNextLaunch)
                 with recording(self, trace) as sbuf:
-                    print >> sbuf, "Command '" + cmd + "' failed!"
+                    print("Command '" + cmd + "' failed!", file=sbuf)
 
         if check:
             self.assertTrue(self.res.Succeeded(),
@@ -2684,7 +2686,7 @@ class TestBase(Base):
             # No execution required, just compare str against the golden input.
             output = str
             with recording(self, trace) as sbuf:
-                print >> sbuf, "looking at:", output
+                print("looking at:", output, file=sbuf)
 
         # The heading says either "Expecting" or "Not expecting".
         heading = "Expecting" if matching else "Not expecting"
@@ -2694,8 +2696,8 @@ class TestBase(Base):
             match_object = re.search(pattern, output)
             matched = bool(match_object)
             with recording(self, trace) as sbuf:
-                print >> sbuf, "%s pattern: %s" % (heading, pattern)
-                print >> sbuf, "Matched" if matched else "Not matched"
+                print("%s pattern: %s" % (heading, pattern), file=sbuf)
+                print("Matched" if matched else "Not matched", file=sbuf)
             if matched:
                 break
 
@@ -2749,7 +2751,7 @@ class TestBase(Base):
             else:
                 output = str
             with recording(self, trace) as sbuf:
-                print >> sbuf, "looking at:", output
+                print("looking at:", output, file=sbuf)
 
         # The heading says either "Expecting" or "Not expecting".
         heading = "Expecting" if matching else "Not expecting"
@@ -2760,16 +2762,16 @@ class TestBase(Base):
 
         if startstr:
             with recording(self, trace) as sbuf:
-                print >> sbuf, "%s start string: %s" % (heading, startstr)
-                print >> sbuf, "Matched" if matched else "Not matched"
+                print("%s start string: %s" % (heading, startstr), file=sbuf)
+                print("Matched" if matched else "Not matched", file=sbuf)
 
         # Look for endstr, if specified.
         keepgoing = matched if matching else not matched
         if endstr:
             matched = output.endswith(endstr)
             with recording(self, trace) as sbuf:
-                print >> sbuf, "%s end string: %s" % (heading, endstr)
-                print >> sbuf, "Matched" if matched else "Not matched"
+                print("%s end string: %s" % (heading, endstr), file=sbuf)
+                print("Matched" if matched else "Not matched", file=sbuf)
 
         # Look for sub strings, if specified.
         keepgoing = matched if matching else not matched
@@ -2777,8 +2779,8 @@ class TestBase(Base):
             for str in substrs:
                 matched = output.find(str) != -1
                 with recording(self, trace) as sbuf:
-                    print >> sbuf, "%s sub string: %s" % (heading, str)
-                    print >> sbuf, "Matched" if matched else "Not matched"
+                    print("%s sub string: %s" % (heading, str), file=sbuf)
+                    print("Matched" if matched else "Not matched", file=sbuf)
                 keepgoing = matched if matching else not matched
                 if not keepgoing:
                     break
@@ -2790,8 +2792,8 @@ class TestBase(Base):
                 # Match Objects always have a boolean value of True.
                 matched = bool(re.search(pattern, output))
                 with recording(self, trace) as sbuf:
-                    print >> sbuf, "%s pattern: %s" % (heading, pattern)
-                    print >> sbuf, "Matched" if matched else "Not matched"
+                    print("%s pattern: %s" % (heading, pattern), file=sbuf)
+                    print("Matched" if matched else "Not matched", file=sbuf)
                 keepgoing = matched if matching else not matched
                 if not keepgoing:
                     break
@@ -2809,7 +2811,7 @@ class TestBase(Base):
                         name + "is a method name of object: " + str(obj))
         result = method()
         with recording(self, trace) as sbuf:
-            print >> sbuf, str(method) + ":",  result
+            print(str(method) + ":",  result, file=sbuf)
         return result
 
     def build(self, architecture=None, compiler=None, dictionary=None, clean=True):
@@ -2869,7 +2871,7 @@ class TestBase(Base):
         if not traceAlways:
             return
 
-        print child
+        print(child)
 
     @classmethod
     def RemoveTempFile(cls, file):

Modified: lldb/trunk/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py Mon Oct 19 18:45:41 2015
@@ -4,6 +4,8 @@ Some of the test suite takes advantage o
 They can also be useful for general purpose lldb scripting.
 """
 
+from __future__ import print_function
+
 import lldb
 import os, sys
 import StringIO
@@ -42,7 +44,7 @@ def disassemble(target, function_or_symb
     buf = StringIO.StringIO()
     insts = function_or_symbol.GetInstructions(target)
     for i in insts:
-        print >> buf, i
+        print(i, file=buf)
     return buf.getvalue()
 
 # ==========================================================
@@ -684,8 +686,8 @@ def print_stacktrace(thread, string_buff
         desc =  "stop reason=" + stop_reason_to_str(thread.GetStopReason())
     else:
         desc = ""
-    print >> output, "Stack trace for thread id={0:#x} name={1} queue={2} ".format(
-        thread.GetThreadID(), thread.GetName(), thread.GetQueueName()) + desc
+    print("Stack trace for thread id={0:#x} name={1} queue={2} ".format(
+        thread.GetThreadID(), thread.GetName(), thread.GetQueueName()) + desc, file=output)
 
     for i in range(depth):
         frame = thread.GetFrameAtIndex(i)
@@ -696,14 +698,14 @@ def print_stacktrace(thread, string_buff
             file_addr = addrs[i].GetFileAddress()
             start_addr = frame.GetSymbol().GetStartAddress().GetFileAddress()
             symbol_offset = file_addr - start_addr
-            print >> output, "  frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}".format(
-                num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset)
+            print("  frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}".format(
+                num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset), file=output)
         else:
-            print >> output, "  frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}".format(
+            print("  frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}".format(
                 num=i, addr=load_addr, mod=mods[i],
                 func='%s [inlined]' % funcs[i] if frame.IsInlined() else funcs[i],
                 file=files[i], line=lines[i],
-                args=get_args_as_string(frame, showFuncName=False) if not frame.IsInlined() else '()')
+                args=get_args_as_string(frame, showFuncName=False) if not frame.IsInlined() else '()'), file=output)
 
     if string_buffer:
         return output.getvalue()
@@ -714,10 +716,10 @@ def print_stacktraces(process, string_bu
 
     output = StringIO.StringIO() if string_buffer else sys.stdout
 
-    print >> output, "Stack traces for " + str(process)
+    print("Stack traces for " + str(process), file=output)
 
     for thread in process:
-        print >> output, print_stacktrace(thread, string_buffer=True)
+        print(print_stacktrace(thread, string_buffer=True), file=output)
 
     if string_buffer:
         return output.getvalue()
@@ -786,15 +788,15 @@ def print_registers(frame, string_buffer
 
     output = StringIO.StringIO() if string_buffer else sys.stdout
 
-    print >> output, "Register sets for " + str(frame)
+    print("Register sets for " + str(frame), file=output)
 
     registerSet = frame.GetRegisters() # Return type of SBValueList.
-    print >> output, "Frame registers (size of register set = %d):" % registerSet.GetSize()
+    print("Frame registers (size of register set = %d):" % registerSet.GetSize(), file=output)
     for value in registerSet:
         #print >> output, value 
-        print >> output, "%s (number of children = %d):" % (value.GetName(), value.GetNumChildren())
+        print("%s (number of children = %d):" % (value.GetName(), value.GetNumChildren()), file=output)
         for child in value:
-            print >> output, "Name: %s, Value: %s" % (child.GetName(), child.GetValue())
+            print("Name: %s, Value: %s" % (child.GetName(), child.GetValue()), file=output)
 
     if string_buffer:
         return output.getvalue()
@@ -868,11 +870,11 @@ class BasicFormatter(object):
             val = value.GetValue()
         if val == None and value.GetNumChildren() > 0:
             val = "%s (location)" % value.GetLocation()
-        print >> output, "{indentation}({type}) {name} = {value}".format(
+        print("{indentation}({type}) {name} = {value}".format(
             indentation = ' ' * indent,
             type = value.GetTypeName(),
             name = value.GetName(),
-            value = val)
+            value = val), file=output)
         return output.getvalue()
 
 class ChildVisitingFormatter(BasicFormatter):

Modified: lldb/trunk/test/progress.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/progress.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/progress.py (original)
+++ lldb/trunk/test/progress.py Mon Oct 19 18:45:41 2015
@@ -1,5 +1,7 @@
 #!/usr/bin/python
 
+from __future__ import print_function
+
 import sys
 import time
 
@@ -146,4 +148,4 @@ if __name__ == '__main__':
         time.sleep(0.3)
         if p.progress == 100:
             break
-    print #new line
\ No newline at end of file
+    print() #new line
\ No newline at end of file

Modified: lldb/trunk/test/redo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/redo.py?rev=250763&r1=250762&r2=250763&view=diff
==============================================================================
--- lldb/trunk/test/redo.py (original)
+++ lldb/trunk/test/redo.py Mon Oct 19 18:45:41 2015
@@ -15,6 +15,8 @@ Type:
 for help.
 """
 
+from __future__ import print_function
+
 import os, sys, datetime
 import re
 
@@ -41,7 +43,7 @@ comp_specs = set()
 arch_specs = set()
 
 def usage():
-    print"""\
+    print("""\
 Usage: redo.py [-F filename_component] [-n] [session_dir] [-d]
 where options:
 -F : only consider the test for re-run if the session filename contains the filename component
@@ -55,7 +57,7 @@ recorded session infos for all the test
 
 If sessin_dir is left unspecified, this script uses the heuristic to find the
 possible session directories with names starting with %Y-%m-%d- (for example,
-2012-01-23-) and employs the one with the latest timestamp."""
+2012-01-23-) and employs the one with the latest timestamp.""")
     sys.exit(0)
 
 def where(session_dir, test_dir):
@@ -99,7 +101,7 @@ def redo(suffix, dir, names):
                         match = filter_pattern.match(line)
                         if match:
                             filterspec = match.group(1)
-                            print "adding filterspec:", filterspec
+                            print("adding filterspec:", filterspec)
                             redo_specs.append(filterspec)
                             comp = comp_pattern.search(line)
                             if comp:
@@ -121,7 +123,7 @@ def main():
     if not test_dir:
         test_dir = os.getcwd()
     if not test_dir.endswith('test'):
-        print "This script expects to reside in lldb's test directory."
+        print("This script expects to reside in lldb's test directory.")
         sys.exit(-1)
 
     index = 1
@@ -157,22 +159,22 @@ def main():
         name = datetime.datetime.now().strftime("%Y-%m-%d-")
         dirs = [d for d in os.listdir(os.getcwd()) if d.startswith(name)]
         if len(dirs) == 0:
-            print "No default session directory found, please specify it explicitly."
+            print("No default session directory found, please specify it explicitly.")
             usage()
         session_dir = max(dirs, key=os.path.getmtime)
         if not session_dir or not os.path.exists(session_dir):
-            print "No default session directory found, please specify it explicitly."
+            print("No default session directory found, please specify it explicitly.")
             usage()
 
     #print "The test directory:", test_dir
     session_dir_path = where(session_dir, test_dir)
 
-    print "Using session dir path:", session_dir_path
+    print("Using session dir path:", session_dir_path)
     os.chdir(test_dir)
     os.path.walk(session_dir_path, redo, ".log")
 
     if not redo_specs:
-        print "No failures/errors recorded within the session directory, please specify a different session directory.\n"
+        print("No failures/errors recorded within the session directory, please specify a different session directory.\n")
         usage()
 
     filters = " -f ".join(redo_specs)
@@ -186,7 +188,7 @@ def main():
     command = "./dotest.py %s %s -v %s %s -f " % (compilers, archs, "" if no_trace else "-t", "-d" if do_delay else "")
 
 
-    print "Running %s" % (command + filters)
+    print("Running %s" % (command + filters))
     os.system(command + filters)
 
 if __name__ == '__main__':




More information about the lldb-commits mailing list