[Lldb-commits] [lldb] r114756 - in /lldb/trunk/test/types: TestBasicTypes.py long.cpp unsigned_int.cpp unsigned_long.cpp
Johnny Chen
johnny.chen at apple.com
Fri Sep 24 13:41:17 PDT 2010
Author: johnny
Date: Fri Sep 24 15:41:17 2010
New Revision: 114756
URL: http://llvm.org/viewvc/llvm-project?rev=114756&view=rev
Log:
Added two new .cpp files to be tested via TestBasicTypes.py for correct display
of various combinations of data structures with unsigned int or unsigned long
builtin types.
Added:
lldb/trunk/test/types/unsigned_int.cpp
lldb/trunk/test/types/unsigned_long.cpp
Modified:
lldb/trunk/test/types/TestBasicTypes.py
lldb/trunk/test/types/long.cpp
Modified: lldb/trunk/test/types/TestBasicTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestBasicTypes.py?rev=114756&r1=114755&r2=114756&view=diff
==============================================================================
--- lldb/trunk/test/types/TestBasicTypes.py (original)
+++ lldb/trunk/test/types/TestBasicTypes.py Fri Sep 24 15:41:17 2010
@@ -33,6 +33,20 @@
self.setTearDownCleanup(dictionary=d)
self.int_type()
+ def test_unsigned_int_type_with_dsym(self):
+ """Test that 'unsigned_int'-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'unsigned_int.cpp'}
+ self.buildDsym(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.unsigned_int_type()
+
+ def test_unsigned_int_type_with_dwarf(self):
+ """Test that 'unsigned int'-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'unsigned_int.cpp'}
+ self.buildDwarf(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.unsigned_int_type()
+
def test_long_type_with_dsym(self):
"""Test that long-type variables are displayed correctly."""
d = {'CXX_SOURCES': 'long.cpp'}
@@ -47,14 +61,36 @@
self.setTearDownCleanup(dictionary=d)
self.long_type()
+ def test_unsigned_long_type_with_dsym(self):
+ """Test that 'unsigned long'-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'unsigned_long.cpp'}
+ self.buildDsym(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.unsigned_long_type()
+
+ def test_unsigned_long_type_with_dwarf(self):
+ """Test that 'unsigned long'-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'unsigned_long.cpp'}
+ self.buildDwarf(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.unsigned_long_type()
+
def int_type(self):
"""Test that int-type variables are displayed correctly."""
self.generic_type_tester("int")
+ def unsigned_int_type(self):
+ """Test that 'unsigned int'-type variables are displayed correctly."""
+ self.generic_type_tester("unsigned int")
+
def long_type(self):
"""Test that long-type variables are displayed correctly."""
self.generic_type_tester("long")
+ def unsigned_long_type(self):
+ """Test that 'unsigned long'-type variables are displayed correctly."""
+ self.generic_type_tester("unsigned long")
+
def generic_type_tester(self, type):
"""Test that variables with basic types are displayed correctly."""
@@ -106,8 +142,20 @@
for var, val in gl:
self.runCmd("frame variable %s" % var)
output = self.res.GetOutput()
+
+ # Extract the display type and canonicalize its atoms into a set.
+ # Same for the input type string.
+ dt = re.match("^\((.*)\)", output).group(1)
+ ds = set(dt.split())
+ ts = set(type.split())
+
+ # The display type set must be a superset of the input type set.
+ if not ds.issuperset(ts):
+ self.fail("The display type: %s must match the input type: %s" %
+ (dt, type))
+
+ # The (var, val) pair must match, too.
self.expect(output, Msg(var, val), exe=False,
- patterns = ["\(%s.*\)" % type],
substrs = [" %s = %s" % (var, val)])
Modified: lldb/trunk/test/types/long.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/long.cpp?rev=114756&r1=114755&r2=114756&view=diff
==============================================================================
--- lldb/trunk/test/types/long.cpp (original)
+++ lldb/trunk/test/types/long.cpp Fri Sep 24 15:41:17 2010
@@ -1,9 +1,18 @@
#define T long
#define T_CSTR "long"
+
+#ifdef __LP64__
#define T_VALUE_1 110011101111
#define T_VALUE_2 220022202222
#define T_VALUE_3 330033303333
#define T_VALUE_4 440044404444
+#else
+#define T_VALUE_1 110011101
+#define T_VALUE_2 220022202
+#define T_VALUE_3 330033303
+#define T_VALUE_4 440044404
+#endif
+
#define T_PRINTF_FORMAT "%ld"
#include "basic_type.cpp"
Added: lldb/trunk/test/types/unsigned_int.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/unsigned_int.cpp?rev=114756&view=auto
==============================================================================
--- lldb/trunk/test/types/unsigned_int.cpp (added)
+++ lldb/trunk/test/types/unsigned_int.cpp Fri Sep 24 15:41:17 2010
@@ -0,0 +1,9 @@
+#define T unsigned int
+#define T_CSTR "unsigned int"
+#define T_VALUE_1 11001110
+#define T_VALUE_2 22002220
+#define T_VALUE_3 33003330
+#define T_VALUE_4 44004440
+#define T_PRINTF_FORMAT "%u"
+
+#include "basic_type.cpp"
Added: lldb/trunk/test/types/unsigned_long.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/unsigned_long.cpp?rev=114756&view=auto
==============================================================================
--- lldb/trunk/test/types/unsigned_long.cpp (added)
+++ lldb/trunk/test/types/unsigned_long.cpp Fri Sep 24 15:41:17 2010
@@ -0,0 +1,18 @@
+#define T unsigned long
+#define T_CSTR "unsigned long"
+
+#ifdef __LP64__
+#define T_VALUE_1 110011101111
+#define T_VALUE_2 220022202222
+#define T_VALUE_3 330033303333
+#define T_VALUE_4 440044404444
+#else
+#define T_VALUE_1 110011101
+#define T_VALUE_2 220022202
+#define T_VALUE_3 330033303
+#define T_VALUE_4 440044404
+#endif
+
+#define T_PRINTF_FORMAT "%ld"
+
+#include "basic_type.cpp"
More information about the lldb-commits
mailing list