From 3bfb8c01d81b01119c21875ea744bafe2f78363c Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Tue, 12 Oct 2010 21:57:42 +0000 Subject: [PATCH] Avoid using hardcoded line number to break on. Use the line_number() utility function to get the line number to break on during setUp(). llvm-svn: 116346 --- .../breakpoint_locations/TestBreakpointLocations.py | 13 ++++++++++--- lldb/test/breakpoint_locations/main.c | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lldb/test/breakpoint_locations/TestBreakpointLocations.py b/lldb/test/breakpoint_locations/TestBreakpointLocations.py index f7195265f260..214682d51ce4 100644 --- a/lldb/test/breakpoint_locations/TestBreakpointLocations.py +++ b/lldb/test/breakpoint_locations/TestBreakpointLocations.py @@ -22,18 +22,25 @@ class BreakpointLocationsTestCase(TestBase): self.buildDwarf() self.breakpoint_locations_test() + def setUp(self): + super(BreakpointLocationsTestCase, self).setUp() + # Find the line number to break inside main(). + self.line = line_number('main.c', '// Set break point at this line.') + def breakpoint_locations_test(self): """Test breakpoint enable/disable for a breakpoint ID with multiple locations.""" exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint with 3 locations. - self.expect("breakpoint set -f main.c -l 19", BREAKPOINT_CREATED, - startstr = "Breakpoint created: 1: file ='main.c', line = 19, locations = 3") + self.expect("breakpoint set -f main.c -l %d" % self.line, + BREAKPOINT_CREATED, + startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 3" % + self.line) # The breakpoint list should show 3 locations. self.expect("breakpoint list", "Breakpoint locations shown correctly", - substrs = ["1: file ='main.c', line = 19, locations = 3"], + substrs = ["1: file ='main.c', line = %d, locations = 3" % self.line], patterns = ["where = a.out`func_inlined .+unresolved, hit count = 0", "where = a.out`main .+\[inlined\].+unresolved, hit count = 0"]) diff --git a/lldb/test/breakpoint_locations/main.c b/lldb/test/breakpoint_locations/main.c index 9679ba4b1918..7ec3ded67b74 100644 --- a/lldb/test/breakpoint_locations/main.c +++ b/lldb/test/breakpoint_locations/main.c @@ -16,7 +16,7 @@ func_inlined (void) printf ("Called func_inlined.\n"); ++func_inline_call_count; printf ("Returning func_inlined call count: %d.\n", func_inline_call_count); - return func_inline_call_count; + return func_inline_call_count; // Set break point at this line. } extern int func_inlined (void);