diff options
author | Johnny Chen <johnny.chen@apple.com> | 2010-09-24 20:41:17 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2010-09-24 20:41:17 +0000 |
commit | c01b78e7b214b0f85f0fceed0fa95bd296818ebc (patch) | |
tree | e0d1b24cd446bfab2851aea38bbbb4b8c1f22cc0 | |
parent | 9d06adcf88a64bce44c14c773c2a12ba5321095a (diff) | |
download | bcm5719-llvm-c01b78e7b214b0f85f0fceed0fa95bd296818ebc.tar.gz bcm5719-llvm-c01b78e7b214b0f85f0fceed0fa95bd296818ebc.zip |
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.
llvm-svn: 114756
-rw-r--r-- | lldb/test/types/TestBasicTypes.py | 50 | ||||
-rw-r--r-- | lldb/test/types/long.cpp | 9 | ||||
-rw-r--r-- | lldb/test/types/unsigned_int.cpp | 9 | ||||
-rw-r--r-- | lldb/test/types/unsigned_long.cpp | 18 |
4 files changed, 85 insertions, 1 deletions
diff --git a/lldb/test/types/TestBasicTypes.py b/lldb/test/types/TestBasicTypes.py index 6eb029a3f16..c11c73a4ac6 100644 --- a/lldb/test/types/TestBasicTypes.py +++ b/lldb/test/types/TestBasicTypes.py @@ -33,6 +33,20 @@ class BasicTypesTestCase(TestBase): 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 @@ class BasicTypesTestCase(TestBase): 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 @@ class BasicTypesTestCase(TestBase): 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)]) diff --git a/lldb/test/types/long.cpp b/lldb/test/types/long.cpp index be91a0c9228..9056b42ee77 100644 --- a/lldb/test/types/long.cpp +++ b/lldb/test/types/long.cpp @@ -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" diff --git a/lldb/test/types/unsigned_int.cpp b/lldb/test/types/unsigned_int.cpp new file mode 100644 index 00000000000..1b307b04afc --- /dev/null +++ b/lldb/test/types/unsigned_int.cpp @@ -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" diff --git a/lldb/test/types/unsigned_long.cpp b/lldb/test/types/unsigned_long.cpp new file mode 100644 index 00000000000..80870fe3144 --- /dev/null +++ b/lldb/test/types/unsigned_long.cpp @@ -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" |