[Lldb-commits] [lldb] r116356 - in /lldb/trunk/test/macosx/universal: TestUniversal.py main.c

Johnny Chen johnny.chen at apple.com
Tue Oct 12 15:39:52 PDT 2010


Author: johnny
Date: Tue Oct 12 17:39:52 2010
New Revision: 116356

URL: http://llvm.org/viewvc/llvm-project?rev=116356&view=rev
Log:
Avoid using hardcoded line number to break on.  Use the line_number() utility
function to get the line number to break on during setUp().

Modified:
    lldb/trunk/test/macosx/universal/TestUniversal.py
    lldb/trunk/test/macosx/universal/main.c

Modified: lldb/trunk/test/macosx/universal/TestUniversal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/universal/TestUniversal.py?rev=116356&r1=116355&r2=116356&view=diff
==============================================================================
--- lldb/trunk/test/macosx/universal/TestUniversal.py (original)
+++ lldb/trunk/test/macosx/universal/TestUniversal.py Tue Oct 12 17:39:52 2010
@@ -9,6 +9,11 @@
 
     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 @@
             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 @@
             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)

Modified: lldb/trunk/test/macosx/universal/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/universal/main.c?rev=116356&r1=116355&r2=116356&view=diff
==============================================================================
--- lldb/trunk/test/macosx/universal/main.c (original)
+++ lldb/trunk/test/macosx/universal/main.c Tue Oct 12 17:39:52 2010
@@ -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;
 }





More information about the lldb-commits mailing list