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.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114756 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/types/TestBasicTypes.py b/test/types/TestBasicTypes.py
index 6eb029a..c11c73a 100644
--- a/test/types/TestBasicTypes.py
+++ b/test/types/TestBasicTypes.py
@@ -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)])
diff --git a/test/types/long.cpp b/test/types/long.cpp
index be91a0c..9056b42 100644
--- a/test/types/long.cpp
+++ b/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/test/types/unsigned_int.cpp b/test/types/unsigned_int.cpp
new file mode 100644
index 0000000..1b307b0
--- /dev/null
+++ b/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/test/types/unsigned_long.cpp b/test/types/unsigned_long.cpp
new file mode 100644
index 0000000..80870fe
--- /dev/null
+++ b/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"