diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 | 
| commit | 14f1b3e8826ce43b978db93a62d1166055db5394 (patch) | |
| tree | 0a00ad8d3498783fe0193f3b656bca17c4c8697d /packages/Python/lldbsuite/test/python_api/lldbutil | |
| parent | 4ee8c119c71a06dcad1e0fecc8c675e480e59337 (diff) | |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/python_api/lldbutil')
4 files changed, 54 insertions, 32 deletions
| diff --git a/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py b/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py index 09a5bc126571..bcbaa68ed928 100644 --- a/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py +++ b/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py @@ -5,13 +5,13 @@ Test utility functions for the frame object.  from __future__ import print_function -  import os  import lldb  from lldbsuite.test.decorators import *  from lldbsuite.test.lldbtest import *  from lldbsuite.test import lldbutil +  class FrameUtilsTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) @@ -36,7 +36,8 @@ class FrameUtilsTestCase(TestBase):          self.assertTrue(breakpoint, VALID_BREAKPOINT)          # Now launch the process, and do not stop at entry point. -        process = target.LaunchSimple (None, None, self.get_process_working_directory()) +        process = target.LaunchSimple( +            None, None, self.get_process_working_directory())          if not process:              self.fail("SBTarget.LaunchProcess() failed") @@ -44,17 +45,19 @@ class FrameUtilsTestCase(TestBase):                          PROCESS_STOPPED)          import lldbsuite.test.lldbutil as lldbutil -        thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) -        self.assertTrue (thread) +        thread = lldbutil.get_stopped_thread( +            process, lldb.eStopReasonBreakpoint) +        self.assertTrue(thread)          frame0 = thread.GetFrameAtIndex(0) -        self.assertTrue (frame0) +        self.assertTrue(frame0)          frame1 = thread.GetFrameAtIndex(1) -        self.assertTrue (frame1) +        self.assertTrue(frame1)          parent = lldbutil.get_parent_frame(frame0)          self.assertTrue(parent and parent.GetFrameID() == frame1.GetFrameID())          frame0_args = lldbutil.get_args_as_string(frame0)          parent_args = lldbutil.get_args_as_string(parent) -        self.assertTrue(frame0_args and parent_args and "(int)val=1" in frame0_args) +        self.assertTrue( +            frame0_args and parent_args and "(int)val=1" in frame0_args)          if self.TraceOn():              lldbutil.print_stacktrace(thread)              print("Current frame: %s" % frame0_args) diff --git a/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py b/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py index 90f879d37610..ae7ec3dfc3cc 100644 --- a/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py +++ b/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py @@ -5,14 +5,15 @@ Test the iteration protocol for some lldb container objects.  from __future__ import print_function - -import os, time +import os +import time  import re  import lldb  from lldbsuite.test.decorators import *  from lldbsuite.test.lldbtest import *  from lldbsuite.test import lldbutil +  class LLDBIteratorTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) @@ -21,7 +22,8 @@ class LLDBIteratorTestCase(TestBase):          # Call super's setUp().          TestBase.setUp(self)          # Find the line numbers to break inside main(). -        self.line1 = line_number('main.cpp', '// Set break point at this line.') +        self.line1 = line_number( +            'main.cpp', '// Set break point at this line.')          self.line2 = line_number('main.cpp', '// And that line.')      @add_test_categories(['pyapi']) @@ -37,7 +39,8 @@ class LLDBIteratorTestCase(TestBase):          self.assertTrue(breakpoint, VALID_BREAKPOINT)          # Now launch the process, and do not stop at entry point. -        process = target.LaunchSimple (None, None, self.get_process_working_directory()) +        process = target.LaunchSimple( +            None, None, self.get_process_working_directory())          if not process:              self.fail("SBTarget.LaunchProcess() failed") @@ -55,8 +58,9 @@ class LLDBIteratorTestCase(TestBase):              if self.TraceOn():                  print("yours[%d]='%s'" % (i, get_description(yours[i])))                  print("mine[%d]='%s'" % (i, get_description(mine[i]))) -            self.assertTrue(yours[i] == mine[i], -                            "UUID+FileSpec of yours[{0}] and mine[{0}] matches".format(i)) +            self.assertTrue( +                yours[i] == mine[i], +                "UUID+FileSpec of yours[{0}] and mine[{0}] matches".format(i))      @add_test_categories(['pyapi'])      def test_lldb_iter_breakpoint(self): @@ -103,7 +107,8 @@ class LLDBIteratorTestCase(TestBase):          self.assertTrue(breakpoint, VALID_BREAKPOINT)          # Now launch the process, and do not stop at entry point. -        process = target.LaunchSimple (None, None, self.get_process_working_directory()) +        process = target.LaunchSimple( +            None, None, self.get_process_working_directory())          if not process:              self.fail("SBTarget.LaunchProcess() failed") diff --git a/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py b/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py index 84ef44d2dd73..49a78888ad89 100644 --- a/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py +++ b/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py @@ -5,14 +5,15 @@ Test the iteration protocol for frame registers.  from __future__ import print_function - -import os, time +import os +import time  import re  import lldb  from lldbsuite.test.decorators import *  from lldbsuite.test.lldbtest import *  from lldbsuite.test import lldbutil +  class RegistersIteratorTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) @@ -21,7 +22,8 @@ class RegistersIteratorTestCase(TestBase):          # Call super's setUp().          TestBase.setUp(self)          # Find the line number to break inside main(). -        self.line1 = line_number('main.cpp', '// Set break point at this line.') +        self.line1 = line_number( +            'main.cpp', '// Set break point at this line.')      @add_test_categories(['pyapi'])      @expectedFailureAll(oslist=["windows"]) @@ -37,7 +39,8 @@ class RegistersIteratorTestCase(TestBase):          self.assertTrue(breakpoint, VALID_BREAKPOINT)          # Now launch the process, and do not stop at entry point. -        process = target.LaunchSimple (None, None, self.get_process_working_directory()) +        process = target.LaunchSimple( +            None, None, self.get_process_working_directory())          if not process:              self.fail("SBTarget.LaunchProcess() failed") @@ -46,14 +49,17 @@ class RegistersIteratorTestCase(TestBase):          for thread in process:              if thread.GetStopReason() == lldb.eStopReasonBreakpoint:                  for frame in thread: -                    # Dump the registers of this frame using lldbutil.get_GPRs() and friends. +                    # Dump the registers of this frame using +                    # lldbutil.get_GPRs() and friends.                      if self.TraceOn():                          print(frame)                      REGs = lldbutil.get_GPRs(frame)                      num = len(REGs)                      if self.TraceOn(): -                        print("\nNumber of general purpose registers: %d" % num) +                        print( +                            "\nNumber of general purpose registers: %d" % +                            num)                      for reg in REGs:                          self.assertTrue(reg)                          if self.TraceOn(): @@ -72,11 +78,15 @@ class RegistersIteratorTestCase(TestBase):                      if self.platformIsDarwin():                          num = len(REGs)                          if self.TraceOn(): -                            print("\nNumber of exception state registers: %d" % num) +                            print( +                                "\nNumber of exception state registers: %d" % +                                num)                          for reg in REGs:                              self.assertTrue(reg)                              if self.TraceOn(): -                                print("%s => %s" % (reg.GetName(), reg.GetValue())) +                                print( +                                    "%s => %s" % +                                    (reg.GetName(), reg.GetValue()))                      else:                          self.assertIsNone(REGs) @@ -86,7 +96,8 @@ class RegistersIteratorTestCase(TestBase):                          REGs = lldbutil.get_registers(frame, kind)                          self.assertTrue(REGs) -                    REGs = lldbutil.get_registers(frame, "Exception State Registers") +                    REGs = lldbutil.get_registers( +                        frame, "Exception State Registers")                      if self.platformIsDarwin():                          self.assertIsNotNone(REGs)                      else: diff --git a/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py b/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py index fafd05fd92c8..b447bb797a0f 100644 --- a/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py +++ b/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py @@ -5,14 +5,15 @@ Test SBprocess and SBThread APIs with printing of the stack traces using lldbuti  from __future__ import print_function - -import os, time +import os +import time  import re  import lldb  from lldbsuite.test.decorators import *  from lldbsuite.test.lldbtest import *  from lldbsuite.test import lldbutil +  class ThreadsStackTracesTestCase(TestBase):      mydir = TestBase.compute_mydir(__file__) @@ -23,11 +24,12 @@ class ThreadsStackTracesTestCase(TestBase):          # Find the line number to break inside main().          self.line = line_number('main.cpp', '// Set break point at this line.') -    @expectedFailureAll("llvm.org/pr23043", ["linux"], archs=["i386"]) # We are unable to produce a backtrace of the main thread when the thread is blocked in fgets - -    #The __thread_start function in libc doesn't contain any epilogue and prologue instructions  -    #hence unwinding fail when we are stopped in __thread_start -    @expectedFailureAll(triple = 'mips*') +    # We are unable to produce a backtrace of the main thread when the thread +    # is blocked in fgets +    @expectedFailureAll("llvm.org/pr23043", ["linux"], archs=["i386"]) +    # The __thread_start function in libc doesn't contain any epilogue and prologue instructions +    # hence unwinding fail when we are stopped in __thread_start +    @expectedFailureAll(triple='mips*')      @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")      @expectedFlakeyAndroid("llvm.org/26492", archs=["arm"])      @expectedFlakeyLinux("llvm.org/pr27687") @@ -44,7 +46,8 @@ class ThreadsStackTracesTestCase(TestBase):          self.assertTrue(breakpoint, VALID_BREAKPOINT)          # Now launch the process, and do not stop at entry point. -        process = target.LaunchSimple (["abc", "xyz"], None, self.get_process_working_directory()) +        process = target.LaunchSimple( +            ["abc", "xyz"], None, self.get_process_working_directory())          if not process:              self.fail("SBTarget.LaunchProcess() failed") @@ -57,4 +60,4 @@ class ThreadsStackTracesTestCase(TestBase):          stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)          self.expect(stacktraces, exe=False, -            substrs = ['(int)argc=3']) +                    substrs=['(int)argc=3']) | 
