[Lldb-commits] [lldb] r116374 - in /lldb/trunk/test/unsigned_types: TestUnsignedTypes.py main.cpp

Johnny Chen johnny.chen at apple.com
Tue Oct 12 16:33:57 PDT 2010


Author: johnny
Date: Tue Oct 12 18:33:57 2010
New Revision: 116374

URL: http://llvm.org/viewvc/llvm-project?rev=116374&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().

Use a pattern to match the output from both gcc-compiled and clang-compiled binary.

Modified:
    lldb/trunk/test/unsigned_types/TestUnsignedTypes.py
    lldb/trunk/test/unsigned_types/main.cpp

Modified: lldb/trunk/test/unsigned_types/TestUnsignedTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/unsigned_types/TestUnsignedTypes.py?rev=116374&r1=116373&r2=116374&view=diff
==============================================================================
--- lldb/trunk/test/unsigned_types/TestUnsignedTypes.py (original)
+++ lldb/trunk/test/unsigned_types/TestUnsignedTypes.py Tue Oct 12 18:33:57 2010
@@ -23,14 +23,21 @@
         self.buildDwarf()
         self.unsigned_types()
 
+    def setUp(self):
+        super(UnsignedTypesTestCase, self).setUp()
+        # Find the line number to break inside main().
+        self.line = line_number('main.cpp', '// Set break point at this line.')
+
     def unsigned_types(self):
         """Test that variables with unsigned types display correctly."""
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break on line 19 in main() aftre the variables are assigned values.
-        self.expect("breakpoint set -f main.cpp -l 19", BREAKPOINT_CREATED,
-            startstr = "Breakpoint created: 1: file ='main.cpp', line = 19, locations = 1")
+        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
+                    BREAKPOINT_CREATED,
+            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
+                        self.line)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -45,8 +52,8 @@
         # Test that unsigned types display correctly.
         self.expect("frame variable -a", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(unsigned char) the_unsigned_char = 'c'",
-            substrs = ["(short unsigned int) the_unsigned_short = 99",
-                       "(unsigned int) the_unsigned_int = 99",
+            patterns = ["\((short unsigned int|unsigned short)\) the_unsigned_short = 99"],
+            substrs = ["(unsigned int) the_unsigned_int = 99",
                        "(long unsigned int) the_unsigned_long = 99",
                        "(long long unsigned int) the_unsigned_long_long = 99",
                        "(uint32_t) the_uint32 = 99"])

Modified: lldb/trunk/test/unsigned_types/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/unsigned_types/main.cpp?rev=116374&r1=116373&r2=116374&view=diff
==============================================================================
--- lldb/trunk/test/unsigned_types/main.cpp (original)
+++ lldb/trunk/test/unsigned_types/main.cpp Tue Oct 12 18:33:57 2010
@@ -16,7 +16,7 @@
     unsigned long long the_unsigned_long_long = 'c';
     uint32_t the_uint32 = 'c';
 
-    return  the_unsigned_char - the_unsigned_short +
+    return  the_unsigned_char - the_unsigned_short + // Set break point at this line.
             the_unsigned_int - the_unsigned_long +
             the_unsigned_long_long - the_uint32;
 }





More information about the lldb-commits mailing list