From 0924b412012e106758528d92511dd3132161e21b Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Tue, 12 Oct 2010 22:39:52 +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: 116356 --- lldb/test/macosx/universal/TestUniversal.py | 17 +++++++++++++---- lldb/test/macosx/universal/main.c | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lldb/test/macosx/universal/TestUniversal.py b/lldb/test/macosx/universal/TestUniversal.py index 7785f63a11f7..935cf30303fc 100644 --- a/lldb/test/macosx/universal/TestUniversal.py +++ b/lldb/test/macosx/universal/TestUniversal.py @@ -9,6 +9,11 @@ class UniversalTestCase(TestBase): mydir = "macosx/universal" + def setUp(self): + super(UniversalTestCase, self).setUp() + # Find the line number to break inside main(). + self.line = line_number('main.c', '// Set break point at this line.') + @unittest2.skipUnless(sys.platform.startswith("darwin") and os.uname()[4]=='i386', "requires Darwin & i386") def test_process_launch_for_universal(self): @@ -26,8 +31,10 @@ class UniversalTestCase(TestBase): substrs = ["testit' (x86_64)."]) # Break inside the main. - self.expect("breakpoint set -f main.c -l 5", BREAKPOINT_CREATED, - startstr = "Breakpoint created: 1: file ='main.c', line = 5, 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) # We should be able to launch the x86_64 executable. self.runCmd("run", RUN_SUCCEEDED) @@ -47,8 +54,10 @@ class UniversalTestCase(TestBase): substrs = ["testit' (i386)."]) # Break inside the main. - self.expect("breakpoint set -f main.c -l 5", BREAKPOINT_CREATED, - startstr = "Breakpoint created: 1: file ='main.c', line = 5, 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) # We should be able to launch the i386 executable as well. self.runCmd("run", RUN_SUCCEEDED) diff --git a/lldb/test/macosx/universal/main.c b/lldb/test/macosx/universal/main.c index ab50a3bcf9d2..9351c77f7146 100644 --- a/lldb/test/macosx/universal/main.c +++ b/lldb/test/macosx/universal/main.c @@ -2,6 +2,6 @@ int main (int argc, char **argv) { - printf ("Hello there!\n"); + printf ("Hello there!\n"); // Set break point at this line. return 0; } -- GitLab