Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test that variable expressions of integer basic types are evaluated correctly. |
| 3 | """ |
| 4 | |
| 5 | import AbstractBase |
| 6 | import unittest2 |
| 7 | import lldb |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 8 | import sys |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 9 | |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 10 | class IntegerTypesTestCase(AbstractBase.GenericTester): |
| 11 | |
| 12 | mydir = "types" |
| 13 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 14 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 15 | def test_char_type_with_dsym(self): |
| 16 | """Test that char-type variable expressions are evaluated correctly.""" |
| 17 | d = {'CXX_SOURCES': 'char.cpp'} |
| 18 | self.buildDsym(dictionary=d) |
| 19 | self.setTearDownCleanup(dictionary=d) |
| 20 | self.char_type_expr() |
| 21 | |
| 22 | def test_char_type_with_dwarf(self): |
| 23 | """Test that char-type variable expressions are evaluated correctly.""" |
| 24 | d = {'CXX_SOURCES': 'char.cpp'} |
| 25 | self.buildDwarf(dictionary=d) |
| 26 | self.setTearDownCleanup(dictionary=d) |
| 27 | self.char_type_expr() |
| 28 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 29 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 30 | def test_unsigned_char_type_with_dsym(self): |
| 31 | """Test that 'unsigned_char'-type variable expressions are evaluated correctly.""" |
| 32 | d = {'CXX_SOURCES': 'unsigned_char.cpp'} |
| 33 | self.buildDsym(dictionary=d) |
| 34 | self.setTearDownCleanup(dictionary=d) |
| 35 | self.unsigned_char_type_expr() |
| 36 | |
| 37 | def test_unsigned_char_type_with_dwarf(self): |
| 38 | """Test that 'unsigned char'-type variable expressions are evaluated correctly.""" |
| 39 | d = {'CXX_SOURCES': 'unsigned_char.cpp'} |
| 40 | self.buildDwarf(dictionary=d) |
| 41 | self.setTearDownCleanup(dictionary=d) |
| 42 | self.unsigned_char_type_expr() |
| 43 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 44 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 45 | def test_short_type_with_dsym(self): |
| 46 | """Test that short-type variable expressions are evaluated correctly.""" |
| 47 | d = {'CXX_SOURCES': 'short.cpp'} |
| 48 | self.buildDsym(dictionary=d) |
| 49 | self.setTearDownCleanup(dictionary=d) |
| 50 | self.short_type_expr() |
| 51 | |
| 52 | def test_short_type_with_dwarf(self): |
| 53 | """Test that short-type variable expressions are evaluated correctly.""" |
| 54 | d = {'CXX_SOURCES': 'short.cpp'} |
| 55 | self.buildDwarf(dictionary=d) |
| 56 | self.setTearDownCleanup(dictionary=d) |
| 57 | self.short_type_expr() |
| 58 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 59 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 60 | def test_unsigned_short_type_with_dsym(self): |
| 61 | """Test that 'unsigned_short'-type variable expressions are evaluated correctly.""" |
| 62 | d = {'CXX_SOURCES': 'unsigned_short.cpp'} |
| 63 | self.buildDsym(dictionary=d) |
| 64 | self.setTearDownCleanup(dictionary=d) |
| 65 | self.unsigned_short_type_expr() |
| 66 | |
| 67 | def test_unsigned_short_type_with_dwarf(self): |
| 68 | """Test that 'unsigned short'-type variable expressions are evaluated correctly.""" |
| 69 | d = {'CXX_SOURCES': 'unsigned_short.cpp'} |
| 70 | self.buildDwarf(dictionary=d) |
| 71 | self.setTearDownCleanup(dictionary=d) |
| 72 | self.unsigned_short_type_expr() |
| 73 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 74 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 75 | def test_int_type_with_dsym(self): |
| 76 | """Test that int-type variable expressions are evaluated correctly.""" |
| 77 | d = {'CXX_SOURCES': 'int.cpp'} |
| 78 | self.buildDsym(dictionary=d) |
| 79 | self.setTearDownCleanup(dictionary=d) |
| 80 | self.int_type_expr() |
| 81 | |
| 82 | def test_int_type_with_dwarf(self): |
| 83 | """Test that int-type variable expressions are evaluated correctly.""" |
| 84 | d = {'CXX_SOURCES': 'int.cpp'} |
| 85 | self.buildDwarf(dictionary=d) |
| 86 | self.setTearDownCleanup(dictionary=d) |
| 87 | self.int_type_expr() |
| 88 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 89 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 90 | def test_unsigned_int_type_with_dsym(self): |
| 91 | """Test that 'unsigned_int'-type variable expressions are evaluated correctly.""" |
| 92 | d = {'CXX_SOURCES': 'unsigned_int.cpp'} |
| 93 | self.buildDsym(dictionary=d) |
| 94 | self.setTearDownCleanup(dictionary=d) |
| 95 | self.unsigned_int_type_expr() |
| 96 | |
| 97 | def test_unsigned_int_type_with_dwarf(self): |
| 98 | """Test that 'unsigned int'-type variable expressions are evaluated correctly.""" |
| 99 | d = {'CXX_SOURCES': 'unsigned_int.cpp'} |
| 100 | self.buildDwarf(dictionary=d) |
| 101 | self.setTearDownCleanup(dictionary=d) |
| 102 | self.unsigned_int_type_expr() |
| 103 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 104 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 105 | def test_long_type_with_dsym(self): |
| 106 | """Test that long-type variable expressions are evaluated correctly.""" |
| 107 | d = {'CXX_SOURCES': 'long.cpp'} |
| 108 | self.buildDsym(dictionary=d) |
| 109 | self.setTearDownCleanup(dictionary=d) |
| 110 | self.long_type_expr() |
| 111 | |
| 112 | def test_long_type_with_dwarf(self): |
| 113 | """Test that long-type variable expressions are evaluated correctly.""" |
| 114 | d = {'CXX_SOURCES': 'long.cpp'} |
| 115 | self.buildDwarf(dictionary=d) |
| 116 | self.setTearDownCleanup(dictionary=d) |
| 117 | self.long_type_expr() |
| 118 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 119 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 120 | def test_unsigned_long_type_with_dsym(self): |
| 121 | """Test that 'unsigned long'-type variable expressions are evaluated correctly.""" |
| 122 | d = {'CXX_SOURCES': 'unsigned_long.cpp'} |
| 123 | self.buildDsym(dictionary=d) |
| 124 | self.setTearDownCleanup(dictionary=d) |
| 125 | self.unsigned_long_type_expr() |
| 126 | |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 127 | def test_unsigned_long_type_with_dwarf(self): |
| 128 | """Test that 'unsigned long'-type variable expressions are evaluated correctly.""" |
| 129 | d = {'CXX_SOURCES': 'unsigned_long.cpp'} |
| 130 | self.buildDwarf(dictionary=d) |
| 131 | self.setTearDownCleanup(dictionary=d) |
| 132 | self.unsigned_long_type_expr() |
| 133 | |
| 134 | # rdar://problem/8482903 |
| 135 | # test suite failure for types dir -- "long long" and "unsigned long long" |
| 136 | |
| 137 | @unittest2.expectedFailure |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 138 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 139 | def test_long_long_type_with_dsym(self): |
| 140 | """Test that 'long long'-type variable expressions are evaluated correctly.""" |
| 141 | d = {'CXX_SOURCES': 'long_long.cpp'} |
| 142 | self.buildDsym(dictionary=d) |
| 143 | self.setTearDownCleanup(dictionary=d) |
| 144 | self.long_long_type_expr() |
| 145 | |
| 146 | @unittest2.expectedFailure |
| 147 | def test_long_long_type_with_dwarf(self): |
| 148 | """Test that 'long long'-type variable expressions are evaluated correctly.""" |
| 149 | d = {'CXX_SOURCES': 'long_long.cpp'} |
| 150 | self.buildDwarf(dictionary=d) |
| 151 | self.setTearDownCleanup(dictionary=d) |
| 152 | self.long_long_type_expr() |
| 153 | |
| 154 | @unittest2.expectedFailure |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame^] | 155 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 156 | def test_unsigned_long_long_type_with_dsym(self): |
| 157 | """Test that 'unsigned long long'-type variable expressions are evaluated correctly.""" |
| 158 | d = {'CXX_SOURCES': 'unsigned_long_long.cpp'} |
| 159 | self.buildDsym(dictionary=d) |
| 160 | self.setTearDownCleanup(dictionary=d) |
| 161 | self.unsigned_long_long_type_expr() |
| 162 | |
| 163 | @unittest2.expectedFailure |
| 164 | def test_unsigned_long_long_type_with_dwarf(self): |
| 165 | """Test that 'unsigned long long'-type variable expressions are evaluated correctly.""" |
| 166 | d = {'CXX_SOURCES': 'unsigned_long_long.cpp'} |
| 167 | self.buildDwarf(dictionary=d) |
| 168 | self.setTearDownCleanup(dictionary=d) |
| 169 | self.unsigned_long_long_type_expr() |
| 170 | |
| 171 | def char_type_expr(self): |
| 172 | """Test that char-type variable expressions are evaluated correctly.""" |
| 173 | self.generic_type_expr_tester(set(['char']), quotedDisplay=True) |
| 174 | |
| 175 | def unsigned_char_type_expr(self): |
| 176 | """Test that 'unsigned char'-type variable expressions are evaluated correctly.""" |
| 177 | self.generic_type_expr_tester(set(['unsigned', 'char']), quotedDisplay=True) |
| 178 | |
| 179 | def short_type_expr(self): |
| 180 | """Test that short-type variable expressions are evaluated correctly.""" |
| 181 | self.generic_type_expr_tester(set(['short'])) |
| 182 | |
| 183 | def unsigned_short_type_expr(self): |
| 184 | """Test that 'unsigned short'-type variable expressions are evaluated correctly.""" |
| 185 | self.generic_type_expr_tester(set(['unsigned', 'short'])) |
| 186 | |
| 187 | def int_type_expr(self): |
| 188 | """Test that int-type variable expressions are evaluated correctly.""" |
| 189 | self.generic_type_expr_tester(set(['int'])) |
| 190 | |
| 191 | def unsigned_int_type_expr(self): |
| 192 | """Test that 'unsigned int'-type variable expressions are evaluated correctly.""" |
| 193 | self.generic_type_expr_tester(set(['unsigned', 'int'])) |
| 194 | |
| 195 | def long_type_expr(self): |
| 196 | """Test that long-type variable expressions are evaluated correctly.""" |
| 197 | self.generic_type_expr_tester(set(['long'])) |
| 198 | |
| 199 | def unsigned_long_type_expr(self): |
| 200 | """Test that 'unsigned long'-type variable expressions are evaluated correctly.""" |
| 201 | self.generic_type_expr_tester(set(['unsigned', 'long'])) |
| 202 | |
| 203 | def long_long_type_expr(self): |
| 204 | """Test that long long-type variable expressions are evaluated correctly.""" |
| 205 | self.generic_type_expr_tester(set(['long long'])) |
| 206 | |
| 207 | def unsigned_long_long_type_expr(self): |
| 208 | """Test that 'unsigned long long'-type variable expressions are evaluated correctly.""" |
| 209 | self.generic_type_expr_tester(set(['unsigned', 'long long'])) |
| 210 | |
| 211 | |
| 212 | if __name__ == '__main__': |
| 213 | import atexit |
| 214 | lldb.SBDebugger.Initialize() |
| 215 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
| 216 | unittest2.main() |