blob: 1d7b3183389d6056b579af7d2348aa3c469b5057 [file] [log] [blame]
Johnny Chenb6c15f52010-09-28 21:03:58 +00001"""
2Test that variable expressions of integer basic types are evaluated correctly.
3"""
4
5import AbstractBase
6import unittest2
7import lldb
Johnny Chen1aabaac2010-10-21 21:58:02 +00008import sys
Johnny Chen5b616ec2012-04-06 21:33:58 +00009from lldbtest import dsym_test, dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +000010
Johnny Chen573335b2010-11-09 18:49:57 +000011class IntegerTypesExprTestCase(AbstractBase.GenericTester):
Johnny Chenb6c15f52010-09-28 21:03:58 +000012
13 mydir = "types"
14
Daniel Maleac09b5c12012-11-20 18:53:21 +000015 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 Maleac676e352012-11-20 19:46:54 +000020 self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
Daniel Maleac09b5c12012-11-20 18:53:21 +000021
Johnny Chen1aabaac2010-10-21 21:58:02 +000022 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +000023 @dsym_test
Johnny Chenb6c15f52010-09-28 21:03:58 +000024 def test_char_type_with_dsym(self):
25 """Test that char-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000026 self.build_and_run_expr('char.cpp', set(['char']), qd=True)
27
28 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +000029 @dsym_test
Johnny Chen85630812012-01-10 02:04:04 +000030 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 Chenb6c15f52010-09-28 21:03:58 +000033
Johnny Chen5b616ec2012-04-06 21:33:58 +000034 @dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +000035 def test_char_type_with_dwarf(self):
36 """Test that char-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000037 self.build_and_run_expr('char.cpp', set(['char']), dsym=False, qd=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +000038
Johnny Chen1aabaac2010-10-21 21:58:02 +000039 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +000040 @dsym_test
Johnny Chenb6c15f52010-09-28 21:03:58 +000041 def test_unsigned_char_type_with_dsym(self):
42 """Test that 'unsigned_char'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000043 self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), qd=True)
44
45 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +000046 @dsym_test
Johnny Chen85630812012-01-10 02:04:04 +000047 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 Chenb6c15f52010-09-28 21:03:58 +000050
Johnny Chen5b616ec2012-04-06 21:33:58 +000051 @dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +000052 def test_unsigned_char_type_with_dwarf(self):
53 """Test that 'unsigned char'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000054 self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), dsym=False, qd=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +000055
Johnny Chen1aabaac2010-10-21 21:58:02 +000056 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +000057 @dsym_test
Johnny Chenb6c15f52010-09-28 21:03:58 +000058 def test_short_type_with_dsym(self):
59 """Test that short-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000060 self.build_and_run_expr('short.cpp', set(['short']))
61
62 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +000063 @dsym_test
Johnny Chen85630812012-01-10 02:04:04 +000064 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 Chenb6c15f52010-09-28 21:03:58 +000067
Johnny Chen5b616ec2012-04-06 21:33:58 +000068 @dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +000069 def test_short_type_with_dwarf(self):
70 """Test that short-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000071 self.build_and_run_expr('short.cpp', set(['short']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +000072
Johnny Chen1aabaac2010-10-21 21:58:02 +000073 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +000074 @dsym_test
Johnny Chenb6c15f52010-09-28 21:03:58 +000075 def test_unsigned_short_type_with_dsym(self):
76 """Test that 'unsigned_short'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000077 self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']))
78
79 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +000080 @dsym_test
Johnny Chen85630812012-01-10 02:04:04 +000081 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 Chenb6c15f52010-09-28 21:03:58 +000084
Johnny Chen5b616ec2012-04-06 21:33:58 +000085 @dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +000086 def test_unsigned_short_type_with_dwarf(self):
87 """Test that 'unsigned short'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000088 self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +000089
Johnny Chen1aabaac2010-10-21 21:58:02 +000090 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +000091 @dsym_test
Johnny Chenb6c15f52010-09-28 21:03:58 +000092 def test_int_type_with_dsym(self):
93 """Test that int-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000094 self.build_and_run_expr('int.cpp', set(['int']))
95
96 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +000097 @dsym_test
Johnny Chen85630812012-01-10 02:04:04 +000098 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 Chenb6c15f52010-09-28 21:03:58 +0000101
Johnny Chen5b616ec2012-04-06 21:33:58 +0000102 @dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000103 def test_int_type_with_dwarf(self):
104 """Test that int-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000105 self.build_and_run_expr('int.cpp', set(['int']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000106
Johnny Chen1aabaac2010-10-21 21:58:02 +0000107 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +0000108 @dsym_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000109 def test_unsigned_int_type_with_dsym(self):
110 """Test that 'unsigned_int'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000111 self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']))
112
113 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +0000114 @dsym_test
Johnny Chen85630812012-01-10 02:04:04 +0000115 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 Chenb6c15f52010-09-28 21:03:58 +0000118
Johnny Chen5b616ec2012-04-06 21:33:58 +0000119 @dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000120 def test_unsigned_int_type_with_dwarf(self):
121 """Test that 'unsigned int'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000122 self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000123
Johnny Chen1aabaac2010-10-21 21:58:02 +0000124 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +0000125 @dsym_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000126 def test_long_type_with_dsym(self):
127 """Test that long-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000128 self.build_and_run_expr('long.cpp', set(['long']))
129
130 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +0000131 @dsym_test
Johnny Chen85630812012-01-10 02:04:04 +0000132 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 Chenb6c15f52010-09-28 21:03:58 +0000135
Johnny Chen5b616ec2012-04-06 21:33:58 +0000136 @dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000137 def test_long_type_with_dwarf(self):
138 """Test that long-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000139 self.build_and_run_expr('long.cpp', set(['long']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000140
Johnny Chen1aabaac2010-10-21 21:58:02 +0000141 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +0000142 @dsym_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000143 def test_unsigned_long_type_with_dsym(self):
144 """Test that 'unsigned long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000145 self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']))
146
147 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +0000148 @dsym_test
Johnny Chen85630812012-01-10 02:04:04 +0000149 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 Chenb6c15f52010-09-28 21:03:58 +0000152
Johnny Chen5b616ec2012-04-06 21:33:58 +0000153 @dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000154 def test_unsigned_long_type_with_dwarf(self):
155 """Test that 'unsigned long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000156 self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000157
158 # rdar://problem/8482903
159 # test suite failure for types dir -- "long long" and "unsigned long long"
160
Johnny Chen1aabaac2010-10-21 21:58:02 +0000161 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +0000162 @dsym_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000163 def test_long_long_type_with_dsym(self):
164 """Test that 'long long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000165 self.build_and_run_expr('long_long.cpp', set(['long long']))
166
167 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +0000168 @dsym_test
Johnny Chen85630812012-01-10 02:04:04 +0000169 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 Chenb6c15f52010-09-28 21:03:58 +0000172
Johnny Chen5b616ec2012-04-06 21:33:58 +0000173 @dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000174 def test_long_long_type_with_dwarf(self):
175 """Test that 'long long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000176 self.build_and_run_expr('long_long.cpp', set(['long long']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000177
Johnny Chen1aabaac2010-10-21 21:58:02 +0000178 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +0000179 @dsym_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000180 def test_unsigned_long_long_type_with_dsym(self):
181 """Test that 'unsigned long long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000182 self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']))
183
184 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chen5b616ec2012-04-06 21:33:58 +0000185 @dsym_test
Johnny Chen85630812012-01-10 02:04:04 +0000186 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 Chenb6c15f52010-09-28 21:03:58 +0000189
Johnny Chen5b616ec2012-04-06 21:33:58 +0000190 @dwarf_test
Johnny Chenb6c15f52010-09-28 21:03:58 +0000191 def test_unsigned_long_long_type_with_dwarf(self):
192 """Test that 'unsigned long long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000193 self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000194
195
196if __name__ == '__main__':
197 import atexit
198 lldb.SBDebugger.Initialize()
199 atexit.register(lambda: lldb.SBDebugger.Terminate())
200 unittest2.main()