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 | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 9 | from lldbtest import dsym_test, dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 10 | |
Johnny Chen | 573335b | 2010-11-09 18:49:57 +0000 | [diff] [blame] | 11 | class IntegerTypesExprTestCase(AbstractBase.GenericTester): |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 12 | |
| 13 | mydir = "types" |
| 14 | |
Daniel Malea | c09b5c1 | 2012-11-20 18:53:21 +0000 | [diff] [blame] | 15 | def setUp(self): |
| 16 | # Call super's setUp(). |
| 17 | AbstractBase.GenericTester.setUp(self) |
| 18 | # disable "There is a running process, kill it and restart?" prompt |
| 19 | self.runCmd("settings set auto-confirm true") |
Daniel Malea | c676e35 | 2012-11-20 19:46:54 +0000 | [diff] [blame] | 20 | self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm")) |
Daniel Malea | c09b5c1 | 2012-11-20 18:53:21 +0000 | [diff] [blame] | 21 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame] | 22 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 23 | @dsym_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 24 | def test_char_type_with_dsym(self): |
| 25 | """Test that char-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 26 | self.build_and_run_expr('char.cpp', set(['char']), qd=True) |
| 27 | |
| 28 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 29 | @dsym_test |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 30 | def test_char_type_from_block_with_dsym(self): |
| 31 | """Test that char-type variables are displayed correctly from a block.""" |
| 32 | self.build_and_run_expr('char.cpp', set(['char']), bc=True, qd=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 33 | |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 34 | @dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 35 | def test_char_type_with_dwarf(self): |
| 36 | """Test that char-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 37 | self.build_and_run_expr('char.cpp', set(['char']), dsym=False, qd=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 38 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame] | 39 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 40 | @dsym_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 41 | def test_unsigned_char_type_with_dsym(self): |
| 42 | """Test that 'unsigned_char'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 43 | self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), qd=True) |
| 44 | |
| 45 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 46 | @dsym_test |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 47 | def test_unsigned_char_type_from_block_with_dsym(self): |
| 48 | """Test that 'unsigned char'-type variables are displayed correctly from a block.""" |
| 49 | self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), bc=True, qd=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 50 | |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 51 | @dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 52 | def test_unsigned_char_type_with_dwarf(self): |
| 53 | """Test that 'unsigned char'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 54 | self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), dsym=False, qd=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 55 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame] | 56 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 57 | @dsym_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 58 | def test_short_type_with_dsym(self): |
| 59 | """Test that short-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 60 | self.build_and_run_expr('short.cpp', set(['short'])) |
| 61 | |
| 62 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 63 | @dsym_test |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 64 | def test_short_type_from_block_with_dsym(self): |
| 65 | """Test that short-type variables are displayed correctly from a block.""" |
| 66 | self.build_and_run_expr('short.cpp', set(['short']), bc=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 67 | |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 68 | @dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 69 | def test_short_type_with_dwarf(self): |
| 70 | """Test that short-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 71 | self.build_and_run_expr('short.cpp', set(['short']), dsym=False) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 72 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame] | 73 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 74 | @dsym_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 75 | def test_unsigned_short_type_with_dsym(self): |
| 76 | """Test that 'unsigned_short'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 77 | self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short'])) |
| 78 | |
| 79 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 80 | @dsym_test |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 81 | def test_unsigned_short_type_from_block_with_dsym(self): |
| 82 | """Test that 'unsigned short'-type variables are displayed correctly from a block.""" |
| 83 | self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']), bc=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 84 | |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 85 | @dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 86 | def test_unsigned_short_type_with_dwarf(self): |
| 87 | """Test that 'unsigned short'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 88 | self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']), dsym=False) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 89 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame] | 90 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 91 | @dsym_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 92 | def test_int_type_with_dsym(self): |
| 93 | """Test that int-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 94 | self.build_and_run_expr('int.cpp', set(['int'])) |
| 95 | |
| 96 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 97 | @dsym_test |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 98 | def test_int_type_from_block_with_dsym(self): |
| 99 | """Test that int-type variables are displayed correctly from a block.""" |
| 100 | self.build_and_run_expr('int.cpp', set(['int']), dsym=False) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 101 | |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 102 | @dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 103 | def test_int_type_with_dwarf(self): |
| 104 | """Test that int-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 105 | self.build_and_run_expr('int.cpp', set(['int']), dsym=False) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 106 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame] | 107 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 108 | @dsym_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 109 | def test_unsigned_int_type_with_dsym(self): |
| 110 | """Test that 'unsigned_int'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 111 | self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int'])) |
| 112 | |
| 113 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 114 | @dsym_test |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 115 | def test_unsigned_int_type_from_block_with_dsym(self): |
| 116 | """Test that 'unsigned int'-type variables are displayed correctly from a block.""" |
| 117 | self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']), bc=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 118 | |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 119 | @dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 120 | def test_unsigned_int_type_with_dwarf(self): |
| 121 | """Test that 'unsigned int'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 122 | self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']), dsym=False) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 123 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame] | 124 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 125 | @dsym_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 126 | def test_long_type_with_dsym(self): |
| 127 | """Test that long-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 128 | self.build_and_run_expr('long.cpp', set(['long'])) |
| 129 | |
| 130 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 131 | @dsym_test |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 132 | def test_long_type_from_block_with_dsym(self): |
| 133 | """Test that long-type variables are displayed correctly from a block.""" |
| 134 | self.build_and_run_expr('long.cpp', set(['long']), bc=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 135 | |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 136 | @dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 137 | def test_long_type_with_dwarf(self): |
| 138 | """Test that long-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 139 | self.build_and_run_expr('long.cpp', set(['long']), dsym=False) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 140 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame] | 141 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 142 | @dsym_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 143 | def test_unsigned_long_type_with_dsym(self): |
| 144 | """Test that 'unsigned long'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 145 | self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long'])) |
| 146 | |
| 147 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 148 | @dsym_test |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 149 | def test_unsigned_long_type_from_block_with_dsym(self): |
| 150 | """Test that 'unsigned_long'-type variables are displayed correctly from a block.""" |
| 151 | self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']), bc=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 152 | |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 153 | @dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 154 | def test_unsigned_long_type_with_dwarf(self): |
| 155 | """Test that 'unsigned long'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 156 | self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']), dsym=False) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 157 | |
| 158 | # rdar://problem/8482903 |
| 159 | # test suite failure for types dir -- "long long" and "unsigned long long" |
| 160 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame] | 161 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 162 | @dsym_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 163 | def test_long_long_type_with_dsym(self): |
| 164 | """Test that 'long long'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 165 | self.build_and_run_expr('long_long.cpp', set(['long long'])) |
| 166 | |
| 167 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 168 | @dsym_test |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 169 | def test_long_long_type_from_block_with_dsym(self): |
| 170 | """Test that 'long_long'-type variables are displayed correctly from a block.""" |
| 171 | self.build_and_run_expr('long_long.cpp', set(['long long']), bc=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 172 | |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 173 | @dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 174 | def test_long_long_type_with_dwarf(self): |
| 175 | """Test that 'long long'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 176 | self.build_and_run_expr('long_long.cpp', set(['long long']), dsym=False) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 177 | |
Johnny Chen | 1aabaac | 2010-10-21 21:58:02 +0000 | [diff] [blame] | 178 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 179 | @dsym_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 180 | def test_unsigned_long_long_type_with_dsym(self): |
| 181 | """Test that 'unsigned long long'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 182 | self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long'])) |
| 183 | |
| 184 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 185 | @dsym_test |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 186 | def test_unsigned_long_long_type_from_block_with_dsym(self): |
| 187 | """Test that 'unsigned_long_long'-type variables are displayed correctly from a block.""" |
| 188 | self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']), bc=True) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 189 | |
Johnny Chen | 5b616ec | 2012-04-06 21:33:58 +0000 | [diff] [blame] | 190 | @dwarf_test |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 191 | def test_unsigned_long_long_type_with_dwarf(self): |
| 192 | """Test that 'unsigned long long'-type variable expressions are evaluated correctly.""" |
Johnny Chen | 8563081 | 2012-01-10 02:04:04 +0000 | [diff] [blame] | 193 | self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']), dsym=False) |
Johnny Chen | b6c15f5 | 2010-09-28 21:03:58 +0000 | [diff] [blame] | 194 | |
| 195 | |
| 196 | if __name__ == '__main__': |
| 197 | import atexit |
| 198 | lldb.SBDebugger.Initialize() |
| 199 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
| 200 | unittest2.main() |