diff options
author | Zachary Turner <zturner@google.com> | 2015-10-28 17:43:26 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-10-28 17:43:26 +0000 |
commit | c432c8f856e0bd84de980a9d9bb2d31b06fa95b1 (patch) | |
tree | 4efa528e074a6e2df782345e4cd97f5d85d038c4 /lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py | |
parent | a8a3bd210086b50242903ed95048fe5e53897878 (diff) | |
download | bcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.tar.gz bcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.zip |
Move lldb/test to lldb/packages/Python/lldbsuite/test.
This is the conclusion of an effort to get LLDB's Python code
structured into a bona-fide Python package. This has a number
of benefits, but most notably the ability to more easily share
Python code between different but related pieces of LLDB's Python
infrastructure (for example, `scripts` can now share code with
`test`).
llvm-svn: 251532
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py new file mode 100644 index 00000000000..87fc4488c36 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py @@ -0,0 +1,62 @@ +""" +Test lldb breakpoint ids. +""" + +from __future__ import print_function + +import use_lldb_suite + +import os, time +import lldb +from lldbtest import * +import lldbutil + +class TestCPPBreakpointLocations(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @expectedFailureWindows("llvm.org/pr24764") + def test (self): + self.build () + self.breakpoint_id_tests () + + def verify_breakpoint_locations(self, target, bp_dict): + + name = bp_dict['name'] + names = bp_dict['loc_names'] + bp = target.BreakpointCreateByName (name) + self.assertTrue (bp.GetNumLocations() == len(names), "Make sure we find the right number of breakpoint locations") + + bp_loc_names = list() + for bp_loc in bp: + bp_loc_names.append(bp_loc.GetAddress().GetFunction().GetName()) + + for name in names: + found = name in bp_loc_names + if not found: + print("Didn't find '%s' in: %s" % (name, bp_loc_names)) + self.assertTrue (found, "Make sure we find all required locations") + + def breakpoint_id_tests (self): + + # Create a target by the debugger. + exe = os.path.join(os.getcwd(), "a.out") + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + bp_dicts = [ + { 'name' : 'func1', 'loc_names' : [ 'a::c::func1()', 'b::c::func1()'] }, + { 'name' : 'func2', 'loc_names' : [ 'a::c::func2()', 'c::d::func2()'] }, + { 'name' : 'func3', 'loc_names' : [ 'a::c::func3()', 'b::c::func3()', 'c::d::func3()'] }, + { 'name' : 'c::func1', 'loc_names' : [ 'a::c::func1()', 'b::c::func1()'] }, + { 'name' : 'c::func2', 'loc_names' : [ 'a::c::func2()'] }, + { 'name' : 'c::func3', 'loc_names' : [ 'a::c::func3()', 'b::c::func3()'] }, + { 'name' : 'a::c::func1', 'loc_names' : [ 'a::c::func1()'] }, + { 'name' : 'b::c::func1', 'loc_names' : [ 'b::c::func1()'] }, + { 'name' : 'c::d::func2', 'loc_names' : [ 'c::d::func2()'] }, + { 'name' : 'a::c::func1()', 'loc_names' : [ 'a::c::func1()'] }, + { 'name' : 'b::c::func1()', 'loc_names' : [ 'b::c::func1()'] }, + { 'name' : 'c::d::func2()', 'loc_names' : [ 'c::d::func2()'] }, + ] + + for bp_dict in bp_dicts: + self.verify_breakpoint_locations(target, bp_dict) |