Avoid using hardcoded line number to break on. Use the line_number() utility
function to get the line number to break on during setUp().
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116352 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/function_types/TestFunctionTypes.py b/test/function_types/TestFunctionTypes.py
index 667a300..1dd14db 100644
--- a/test/function_types/TestFunctionTypes.py
+++ b/test/function_types/TestFunctionTypes.py
@@ -20,14 +20,21 @@
self.buildDwarf()
self.function_types()
+ def setUp(self):
+ super(FunctionTypesTestCase, self).setUp()
+ # Find the line number to break inside main().
+ self.line = line_number('main.c', '// Set break point at this line.')
+
def function_types(self):
"""Test 'callback' has function ptr type, then break on the function."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- self.expect("breakpoint set -f main.c -l 21", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = 21, locations = 1")
+ self.expect("breakpoint set -f main.c -l %d" % self.line,
+ BREAKPOINT_CREATED,
+ startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
+ self.line)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/test/function_types/main.c b/test/function_types/main.c
index 3c968e4..8be3c4d 100644
--- a/test/function_types/main.c
+++ b/test/function_types/main.c
@@ -18,5 +18,5 @@
{
int (*callback)(const char *) = string_not_empty;
- return callback(0);
+ return callback(0); // Set break point at this line.
}