summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py66
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/main.cpp20
2 files changed, 57 insertions, 29 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
index 8157b1c2575..a250dfdd398 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
@@ -19,8 +19,8 @@ class CPP11EnumTypesTestCase(TestBase):
"""Test C++11 enumeration class types as int8_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int8_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int8_t"'})
+ self.image_lookup_for_enum_type(True)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
@@ -28,8 +28,8 @@ class CPP11EnumTypesTestCase(TestBase):
"""Test C++11 enumeration class types as int16_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int16_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int16_t"'})
+ self.image_lookup_for_enum_type(True)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
@@ -37,8 +37,8 @@ class CPP11EnumTypesTestCase(TestBase):
"""Test C++11 enumeration class types as int32_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int32_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int32_t"'})
+ self.image_lookup_for_enum_type(True)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
@@ -46,8 +46,8 @@ class CPP11EnumTypesTestCase(TestBase):
"""Test C++11 enumeration class types as int64_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int64_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DSIGNED_ENUM_CLASS_TYPE=int64_t"'})
+ self.image_lookup_for_enum_type(True)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
@@ -55,8 +55,8 @@ class CPP11EnumTypesTestCase(TestBase):
"""Test C++11 enumeration class types as uint8_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint8_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DUNSIGNED_ENUM_CLASS_TYPE=uint8_t"'})
+ self.image_lookup_for_enum_type(False)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
@@ -64,8 +64,8 @@ class CPP11EnumTypesTestCase(TestBase):
"""Test C++11 enumeration class types as uint16_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint16_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DUNSIGNED_ENUM_CLASS_TYPE=uint16_t"'})
+ self.image_lookup_for_enum_type(False)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
@@ -73,8 +73,8 @@ class CPP11EnumTypesTestCase(TestBase):
"""Test C++11 enumeration class types as uint32_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint32_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DUNSIGNED_ENUM_CLASS_TYPE=uint32_t"'})
+ self.image_lookup_for_enum_type(False)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr36527')
@skipIf(dwarf_version=['<', '4'])
@@ -82,8 +82,8 @@ class CPP11EnumTypesTestCase(TestBase):
"""Test C++11 enumeration class types as uint64_t types."""
self.build(
dictionary={
- 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint64_t"'})
- self.image_lookup_for_enum_type()
+ 'CFLAGS_EXTRAS': '"-DUNSIGNED_ENUM_CLASS_TYPE=uint64_t"'})
+ self.image_lookup_for_enum_type(False)
def setUp(self):
# Call super's setUp().
@@ -91,7 +91,7 @@ class CPP11EnumTypesTestCase(TestBase):
# Find the line number to break inside main().
self.line = line_number('main.cpp', '// Set break point at this line.')
- def image_lookup_for_enum_type(self):
+ def image_lookup_for_enum_type(self, is_signed):
"""Test C++11 enumeration class types."""
exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
@@ -125,16 +125,28 @@ class CPP11EnumTypesTestCase(TestBase):
'kNumDays',
'}'])
- enum_values = ['-4',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday',
- 'Sunday',
- 'kNumDays',
- '5']
+ if is_signed:
+ enum_values = ['-4',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ 'Sunday',
+ 'kNumDays',
+ '5']
+ else:
+ enum_values = ['199',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ 'Sunday',
+ 'kNumDays',
+ '208']
bkpt = self.target().FindBreakpointByID(bkpt_id)
for enum_value in enum_values:
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/main.cpp
index 31d130cce90..e00fc2df460 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/main.cpp
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/main.cpp
@@ -11,7 +11,8 @@
int main (int argc, char const *argv[])
{
- typedef int16_t enum_integer_t;
+#ifdef SIGNED_ENUM_CLASS_TYPE
+ typedef SIGNED_ENUM_CLASS_TYPE enum_integer_t;
enum class DayType : enum_integer_t {
Monday = -3,
Tuesday,
@@ -23,10 +24,25 @@ int main (int argc, char const *argv[])
kNumDays
};
enum_integer_t day_value;
+#else
+ typedef UNSIGNED_ENUM_CLASS_TYPE enum_integer_t;
+ enum class DayType : enum_integer_t {
+ Monday = 200,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday,
+ Sunday,
+ kNumDays
+ };
+ enum_integer_t day_value;
+#endif
+
for (day_value = (enum_integer_t)DayType::Monday - 1; day_value <= (enum_integer_t)DayType::kNumDays + 1; ++day_value)
{
DayType day = (DayType)day_value;
printf("day as int is %i\n", (int)day); // Set break point at this line.
}
- return 0;
+ return 0; // Break here for char tests
}
OpenPOWER on IntegriCloud