zturner created this revision.
zturner added a reviewer: tfiala.
zturner added a subscriber: lldb-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

Hi Todd,

I've been putting most of this stuff in withouty review, but I figure every 
once in a while I should pass one your way as a sanity check to make sure I'm 
still on the right path.

Anyway, for this one.  `xrange()` is removed from Python 3, and `range()` is no 
longer a function but a "sequence object" which must be converted to a list.  
In theory I could have used `six.moves.xrange`, but I decided that the 
efficiency provided by `xrange` wasn't important in the code, so I changed it 
all to use `range` instead.

http://reviews.llvm.org/D14023

Files:
  test/example/TestSequenceFunctions.py
  test/functionalities/inferior-assert/TestInferiorAssert.py
  test/functionalities/inferior-crashing/TestInferiorCrashing.py
  
test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
  test/lang/go/goroutines/TestGoroutines.py
  test/lang/go/types/TestGoASTContext.py
  test/lldbutil.py
  test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py

Index: test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
===================================================================
--- test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
+++ test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
@@ -34,7 +34,7 @@
 
     @llgs_test
     # std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836
-    @expectedFailureAndroid(api_levels=range(16 + 1))
+    @expectedFailureAndroid(api_levels=list(range(16 + 1)))
     def test_inferior_abort_received_llgs(self):
         self.init_llgs_test()
         self.build()
Index: test/lldbutil.py
===================================================================
--- test/lldbutil.py
+++ test/lldbutil.py
@@ -607,7 +607,7 @@
     def GetFuncName(i):
         return thread.GetFrameAtIndex(i).GetFunctionName()
 
-    return list(map(GetFuncName, range(thread.GetNumFrames())))
+    return list(map(GetFuncName, list(range(thread.GetNumFrames()))))
 
 
 def get_symbol_names(thread):
@@ -617,7 +617,7 @@
     def GetSymbol(i):
         return thread.GetFrameAtIndex(i).GetSymbol().GetName()
 
-    return list(map(GetSymbol, range(thread.GetNumFrames())))
+    return list(map(GetSymbol, list(range(thread.GetNumFrames()))))
 
 
 def get_pc_addresses(thread):
@@ -627,7 +627,7 @@
     def GetPCAddress(i):
         return thread.GetFrameAtIndex(i).GetPCAddress()
 
-    return list(map(GetPCAddress, range(thread.GetNumFrames())))
+    return list(map(GetPCAddress, list(range(thread.GetNumFrames()))))
 
 
 def get_filenames(thread):
@@ -637,7 +637,7 @@
     def GetFilename(i):
         return thread.GetFrameAtIndex(i).GetLineEntry().GetFileSpec().GetFilename()
 
-    return list(map(GetFilename, range(thread.GetNumFrames())))
+    return list(map(GetFilename, list(range(thread.GetNumFrames()))))
 
 
 def get_line_numbers(thread):
@@ -647,7 +647,7 @@
     def GetLineNumber(i):
         return thread.GetFrameAtIndex(i).GetLineEntry().GetLine()
 
-    return list(map(GetLineNumber, range(thread.GetNumFrames())))
+    return list(map(GetLineNumber, list(range(thread.GetNumFrames()))))
 
 
 def get_module_names(thread):
@@ -657,7 +657,7 @@
     def GetModuleName(i):
         return thread.GetFrameAtIndex(i).GetModule().GetFileSpec().GetFilename()
 
-    return list(map(GetModuleName, range(thread.GetNumFrames())))
+    return list(map(GetModuleName, list(range(thread.GetNumFrames()))))
 
 
 def get_stack_frames(thread):
@@ -667,7 +667,7 @@
     def GetStackFrame(i):
         return thread.GetFrameAtIndex(i)
 
-    return list(map(GetStackFrame, range(thread.GetNumFrames())))
+    return list(map(GetStackFrame, list(range(thread.GetNumFrames()))))
 
 
 def print_stacktrace(thread, string_buffer = False):
Index: test/lang/go/types/TestGoASTContext.py
===================================================================
--- test/lang/go/types/TestGoASTContext.py
+++ test/lang/go/types/TestGoASTContext.py
@@ -9,6 +9,8 @@
 import lldbutil
 from lldbtest import *
 
+import six.moves
+
 class TestGoASTContext(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -129,5 +131,5 @@
 
         v = self.var('theArray')
         self.assertEqual(5, v.GetNumChildren())
-        for i in xrange(5):
+        for i in six.moves.xrange(5):
             self.assertEqual(str(i + 1), v.GetChildAtIndex(i).value)
Index: test/lang/go/goroutines/TestGoroutines.py
===================================================================
--- test/lang/go/goroutines/TestGoroutines.py
+++ test/lang/go/goroutines/TestGoroutines.py
@@ -9,6 +9,8 @@
 import lldbutil
 from lldbtest import *
 
+import six.moves
+
 class TestGoASTContext(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -75,7 +77,7 @@
         # self.dbg.HandleCommand("log enable lldb os")
 
         # Now test that stepping works if the memory thread moves to a different backing thread.
-        for i in xrange(11):
+        for i in six.moves.xrange(11):
             self.thread().StepOver()
             self.assertEqual(lldb.eStopReasonPlanComplete, self.thread().GetStopReason(), self.thread().GetStopDescription(100))
         
Index: test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
===================================================================
--- test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
+++ test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
@@ -47,7 +47,7 @@
 
     @expectedFailureFreeBSD('llvm.org/pr24939')
     @expectedFailureWindows("llvm.org/pr24778")
-    @expectedFailureAndroid(archs=['aarch64'], api_levels=range(21 + 1)) # No eh_frame for sa_restorer
+    @expectedFailureAndroid(archs=['aarch64'], api_levels=list(range(21 + 1))) # No eh_frame for sa_restorer
     def test_recursive_inferior_crashing_step_after_break(self):
         """Test that lldb functions correctly after stepping through a crash."""
         self.build()
Index: test/functionalities/inferior-crashing/TestInferiorCrashing.py
===================================================================
--- test/functionalities/inferior-crashing/TestInferiorCrashing.py
+++ test/functionalities/inferior-crashing/TestInferiorCrashing.py
@@ -47,7 +47,7 @@
 
     @expectedFailureFreeBSD('llvm.org/pr24939')
     @expectedFailureWindows("llvm.org/pr24778")
-    @expectedFailureAndroid(archs=['aarch64'], api_levels=range(21 + 1)) # No eh_frame for sa_restorer
+    @expectedFailureAndroid(archs=['aarch64'], api_levels=list(range(21 + 1))) # No eh_frame for sa_restorer
     def test_inferior_crashing_step_after_break(self):
         """Test that lldb functions correctly after stepping through a crash."""
         self.build()
Index: test/functionalities/inferior-assert/TestInferiorAssert.py
===================================================================
--- test/functionalities/inferior-assert/TestInferiorAssert.py
+++ test/functionalities/inferior-assert/TestInferiorAssert.py
@@ -20,7 +20,7 @@
         self.inferior_asserting()
 
     @expectedFailureWindows("llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
-    @expectedFailureAndroid(api_levels=range(16 + 1)) # b.android.com/179836
+    @expectedFailureAndroid(api_levels=list(range(16 + 1))) # b.android.com/179836
     def test_inferior_asserting_register(self):
         """Test that lldb reliably reads registers from the inferior after asserting (command)."""
         self.build()
@@ -58,7 +58,7 @@
         lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
 
     def check_stop_reason(self):
-        if matchAndroid(api_levels=range(1, 16+1))(self):
+        if matchAndroid(api_levels=list(range(1, 16+1)))(self):
             # On android until API-16 the abort() call ended in a sigsegv instead of in a sigabrt
             stop_reason = 'stop reason = signal SIGSEGV'
         else:
Index: test/example/TestSequenceFunctions.py
===================================================================
--- test/example/TestSequenceFunctions.py
+++ test/example/TestSequenceFunctions.py
@@ -8,7 +8,7 @@
 
     def setUp(self):
         #traceback.print_stack()
-        self.seq = range(10)
+        self.seq = list(range(10))
 
     def tearDown(self):
         #traceback.print_stack()
@@ -18,7 +18,7 @@
         # make sure the shuffled sequence does not lose any elements
         random.shuffle(self.seq)
         self.seq.sort()
-        self.assertEqual(self.seq, range(10))
+        self.assertEqual(self.seq, list(range(10)))
 
     def test_choice(self):
         element = random.choice(self.seq)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to