blob: 028d63153db1f5a81c4e8709813528a52350a885 [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 Chenb6c15f52010-09-28 21:03:58 +00009
Johnny Chen573335b2010-11-09 18:49:57 +000010class IntegerTypesExprTestCase(AbstractBase.GenericTester):
Johnny Chenb6c15f52010-09-28 21:03:58 +000011
12 mydir = "types"
13
Johnny Chen1aabaac2010-10-21 21:58:02 +000014 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chenb6c15f52010-09-28 21:03:58 +000015 def test_char_type_with_dsym(self):
16 """Test that char-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000017 self.build_and_run_expr('char.cpp', set(['char']), qd=True)
18
19 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
20 def test_char_type_from_block_with_dsym(self):
21 """Test that char-type variables are displayed correctly from a block."""
22 self.build_and_run_expr('char.cpp', set(['char']), bc=True, qd=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +000023
24 def test_char_type_with_dwarf(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']), dsym=False, qd=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +000027
Johnny Chen1aabaac2010-10-21 21:58:02 +000028 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chenb6c15f52010-09-28 21:03:58 +000029 def test_unsigned_char_type_with_dsym(self):
30 """Test that 'unsigned_char'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000031 self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), qd=True)
32
33 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
34 def test_unsigned_char_type_from_block_with_dsym(self):
35 """Test that 'unsigned char'-type variables are displayed correctly from a block."""
36 self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), bc=True, qd=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +000037
38 def test_unsigned_char_type_with_dwarf(self):
39 """Test that 'unsigned char'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000040 self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), dsym=False, qd=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +000041
Johnny Chen1aabaac2010-10-21 21:58:02 +000042 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chenb6c15f52010-09-28 21:03:58 +000043 def test_short_type_with_dsym(self):
44 """Test that short-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000045 self.build_and_run_expr('short.cpp', set(['short']))
46
47 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
48 def test_short_type_from_block_with_dsym(self):
49 """Test that short-type variables are displayed correctly from a block."""
50 self.build_and_run_expr('short.cpp', set(['short']), bc=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +000051
52 def test_short_type_with_dwarf(self):
53 """Test that short-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000054 self.build_and_run_expr('short.cpp', set(['short']), dsym=False)
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 Chenb6c15f52010-09-28 21:03:58 +000057 def test_unsigned_short_type_with_dsym(self):
58 """Test that 'unsigned_short'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000059 self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']))
60
61 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
62 def test_unsigned_short_type_from_block_with_dsym(self):
63 """Test that 'unsigned short'-type variables are displayed correctly from a block."""
64 self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']), bc=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +000065
66 def test_unsigned_short_type_with_dwarf(self):
67 """Test that 'unsigned short'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000068 self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +000069
Johnny Chen1aabaac2010-10-21 21:58:02 +000070 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chenb6c15f52010-09-28 21:03:58 +000071 def test_int_type_with_dsym(self):
72 """Test that int-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000073 self.build_and_run_expr('int.cpp', set(['int']))
74
75 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
76 def test_int_type_from_block_with_dsym(self):
77 """Test that int-type variables are displayed correctly from a block."""
78 self.build_and_run_expr('int.cpp', set(['int']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +000079
80 def test_int_type_with_dwarf(self):
81 """Test that int-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000082 self.build_and_run_expr('int.cpp', set(['int']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +000083
Johnny Chen1aabaac2010-10-21 21:58:02 +000084 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chenb6c15f52010-09-28 21:03:58 +000085 def test_unsigned_int_type_with_dsym(self):
86 """Test that 'unsigned_int'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000087 self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']))
88
89 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
90 def test_unsigned_int_type_from_block_with_dsym(self):
91 """Test that 'unsigned int'-type variables are displayed correctly from a block."""
92 self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']), bc=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +000093
94 def test_unsigned_int_type_with_dwarf(self):
95 """Test that 'unsigned int'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +000096 self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +000097
Johnny Chen1aabaac2010-10-21 21:58:02 +000098 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chenb6c15f52010-09-28 21:03:58 +000099 def test_long_type_with_dsym(self):
100 """Test that long-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000101 self.build_and_run_expr('long.cpp', set(['long']))
102
103 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
104 def test_long_type_from_block_with_dsym(self):
105 """Test that long-type variables are displayed correctly from a block."""
106 self.build_and_run_expr('long.cpp', set(['long']), bc=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000107
108 def test_long_type_with_dwarf(self):
109 """Test that long-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000110 self.build_and_run_expr('long.cpp', set(['long']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000111
Johnny Chen1aabaac2010-10-21 21:58:02 +0000112 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chenb6c15f52010-09-28 21:03:58 +0000113 def test_unsigned_long_type_with_dsym(self):
114 """Test that 'unsigned long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000115 self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']))
116
117 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
118 def test_unsigned_long_type_from_block_with_dsym(self):
119 """Test that 'unsigned_long'-type variables are displayed correctly from a block."""
120 self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']), bc=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000121
Johnny Chenb6c15f52010-09-28 21:03:58 +0000122 def test_unsigned_long_type_with_dwarf(self):
123 """Test that 'unsigned long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000124 self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000125
126 # rdar://problem/8482903
127 # test suite failure for types dir -- "long long" and "unsigned long long"
128
Johnny Chen1aabaac2010-10-21 21:58:02 +0000129 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chenb6c15f52010-09-28 21:03:58 +0000130 def test_long_long_type_with_dsym(self):
131 """Test that 'long long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000132 self.build_and_run_expr('long_long.cpp', set(['long long']))
133
134 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
135 def test_long_long_type_from_block_with_dsym(self):
136 """Test that 'long_long'-type variables are displayed correctly from a block."""
137 self.build_and_run_expr('long_long.cpp', set(['long long']), bc=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000138
Johnny Chenb6c15f52010-09-28 21:03:58 +0000139 def test_long_long_type_with_dwarf(self):
140 """Test that 'long long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000141 self.build_and_run_expr('long_long.cpp', set(['long long']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000142
Johnny Chen1aabaac2010-10-21 21:58:02 +0000143 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
Johnny Chenb6c15f52010-09-28 21:03:58 +0000144 def test_unsigned_long_long_type_with_dsym(self):
145 """Test that 'unsigned long long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000146 self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']))
147
148 @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
149 def test_unsigned_long_long_type_from_block_with_dsym(self):
150 """Test that 'unsigned_long_long'-type variables are displayed correctly from a block."""
151 self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']), bc=True)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000152
Johnny Chenb6c15f52010-09-28 21:03:58 +0000153 def test_unsigned_long_long_type_with_dwarf(self):
154 """Test that 'unsigned long long'-type variable expressions are evaluated correctly."""
Johnny Chen85630812012-01-10 02:04:04 +0000155 self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']), dsym=False)
Johnny Chenb6c15f52010-09-28 21:03:58 +0000156
157
158if __name__ == '__main__':
159 import atexit
160 lldb.SBDebugger.Initialize()
161 atexit.register(lambda: lldb.SBDebugger.Terminate())
162 unittest2.main()