|
| 1 | +""" |
| 2 | +Test lldb Python API object's default constructor to make sure it is invalid |
| 3 | +after initial construction. |
| 4 | +
|
| 5 | +There are two exceptions to the above general rules, though; the API objects are |
| 6 | +SBCommadnReturnObject and SBStream. |
| 7 | +""" |
| 8 | + |
| 9 | +import os, time |
| 10 | +import re |
| 11 | +import unittest2 |
| 12 | +import lldb, lldbutil |
| 13 | +from lldbtest import * |
| 14 | + |
| 15 | +class APIDefaultConstructorTestCase(TestBase): |
| 16 | + |
| 17 | + mydir = os.path.join("python_api", "default-constructor") |
| 18 | + |
| 19 | + @python_api_test |
| 20 | + def test_SBAddress(self): |
| 21 | + obj = lldb.SBAddress() |
| 22 | + if self.TraceOn(): |
| 23 | + print obj |
| 24 | + self.assertFalse(obj) |
| 25 | + |
| 26 | + @python_api_test |
| 27 | + def test_SBBlock(self): |
| 28 | + obj = lldb.SBBlock() |
| 29 | + if self.TraceOn(): |
| 30 | + print obj |
| 31 | + self.assertFalse(obj) |
| 32 | + |
| 33 | + @python_api_test |
| 34 | + def test_SBBreakpoint(self): |
| 35 | + obj = lldb.SBBreakpoint() |
| 36 | + if self.TraceOn(): |
| 37 | + print obj |
| 38 | + self.assertFalse(obj) |
| 39 | + |
| 40 | + @python_api_test |
| 41 | + def test_SBBreakpointLocation(self): |
| 42 | + obj = lldb.SBBreakpointLocation() |
| 43 | + if self.TraceOn(): |
| 44 | + print obj |
| 45 | + self.assertFalse(obj) |
| 46 | + |
| 47 | + @python_api_test |
| 48 | + def test_SBBroadcaster(self): |
| 49 | + obj = lldb.SBBroadcaster() |
| 50 | + if self.TraceOn(): |
| 51 | + print obj |
| 52 | + self.assertFalse(obj) |
| 53 | + |
| 54 | + @python_api_test |
| 55 | + def test_SBCommandReturnObject(self): |
| 56 | + """SBCommandReturnObject object is valid after default construction.""" |
| 57 | + obj = lldb.SBCommandReturnObject() |
| 58 | + if self.TraceOn(): |
| 59 | + print obj |
| 60 | + self.assertTrue(obj) |
| 61 | + |
| 62 | + @python_api_test |
| 63 | + def test_SBCommunication(self): |
| 64 | + obj = lldb.SBCommunication() |
| 65 | + if self.TraceOn(): |
| 66 | + print obj |
| 67 | + self.assertFalse(obj) |
| 68 | + |
| 69 | + @python_api_test |
| 70 | + def test_SBCompileUnit(self): |
| 71 | + obj = lldb.SBCompileUnit() |
| 72 | + if self.TraceOn(): |
| 73 | + print obj |
| 74 | + self.assertFalse(obj) |
| 75 | + |
| 76 | + @python_api_test |
| 77 | + def test_SBDebugger(self): |
| 78 | + obj = lldb.SBDebugger() |
| 79 | + if self.TraceOn(): |
| 80 | + print obj |
| 81 | + self.assertFalse(obj) |
| 82 | + |
| 83 | + @python_api_test |
| 84 | + def test_SBError(self): |
| 85 | + obj = lldb.SBError() |
| 86 | + if self.TraceOn(): |
| 87 | + print obj |
| 88 | + self.assertFalse(obj) |
| 89 | + |
| 90 | + @python_api_test |
| 91 | + def test_SBEvent(self): |
| 92 | + obj = lldb.SBEvent() |
| 93 | + if self.TraceOn(): |
| 94 | + print obj |
| 95 | + self.assertFalse(obj) |
| 96 | + |
| 97 | + @python_api_test |
| 98 | + def test_SBFileSpec(self): |
| 99 | + obj = lldb.SBFileSpec() |
| 100 | + if self.TraceOn(): |
| 101 | + print obj |
| 102 | + self.assertFalse(obj) |
| 103 | + |
| 104 | + @python_api_test |
| 105 | + def test_SBFrame(self): |
| 106 | + obj = lldb.SBFrame() |
| 107 | + if self.TraceOn(): |
| 108 | + print obj |
| 109 | + self.assertFalse(obj) |
| 110 | + |
| 111 | + @python_api_test |
| 112 | + def test_SBFunction(self): |
| 113 | + obj = lldb.SBFunction() |
| 114 | + if self.TraceOn(): |
| 115 | + print obj |
| 116 | + self.assertFalse(obj) |
| 117 | + |
| 118 | + @python_api_test |
| 119 | + def test_SBInputReader(self): |
| 120 | + obj = lldb.SBInputReader() |
| 121 | + if self.TraceOn(): |
| 122 | + print obj |
| 123 | + self.assertFalse(obj) |
| 124 | + |
| 125 | + @python_api_test |
| 126 | + def test_SBInstruction(self): |
| 127 | + obj = lldb.SBInstruction() |
| 128 | + if self.TraceOn(): |
| 129 | + print obj |
| 130 | + self.assertFalse(obj) |
| 131 | + |
| 132 | + @python_api_test |
| 133 | + def test_SBInstructionList(self): |
| 134 | + obj = lldb.SBInstructionList() |
| 135 | + if self.TraceOn(): |
| 136 | + print obj |
| 137 | + self.assertFalse(obj) |
| 138 | + |
| 139 | + @python_api_test |
| 140 | + def test_SBLineEntry(self): |
| 141 | + obj = lldb.SBLineEntry() |
| 142 | + if self.TraceOn(): |
| 143 | + print obj |
| 144 | + self.assertFalse(obj) |
| 145 | + |
| 146 | + @python_api_test |
| 147 | + def test_SBListener(self): |
| 148 | + obj = lldb.SBListener() |
| 149 | + if self.TraceOn(): |
| 150 | + print obj |
| 151 | + self.assertFalse(obj) |
| 152 | + |
| 153 | + @python_api_test |
| 154 | + def test_SBModule(self): |
| 155 | + obj = lldb.SBModule() |
| 156 | + if self.TraceOn(): |
| 157 | + print obj |
| 158 | + self.assertFalse(obj) |
| 159 | + |
| 160 | + @python_api_test |
| 161 | + def test_SBProcess(self): |
| 162 | + obj = lldb.SBProcess() |
| 163 | + if self.TraceOn(): |
| 164 | + print obj |
| 165 | + self.assertFalse(obj) |
| 166 | + |
| 167 | + @python_api_test |
| 168 | + def test_SBStream(self): |
| 169 | + """SBStream object is valid after default construction.""" |
| 170 | + obj = lldb.SBStream() |
| 171 | + if self.TraceOn(): |
| 172 | + print obj |
| 173 | + self.assertTrue(obj) |
| 174 | + |
| 175 | + @python_api_test |
| 176 | + def test_SBStringList(self): |
| 177 | + obj = lldb.SBStringList() |
| 178 | + if self.TraceOn(): |
| 179 | + print obj |
| 180 | + self.assertFalse(obj) |
| 181 | + |
| 182 | + @python_api_test |
| 183 | + def test_SBSymbol(self): |
| 184 | + obj = lldb.SBSymbol() |
| 185 | + if self.TraceOn(): |
| 186 | + print obj |
| 187 | + self.assertFalse(obj) |
| 188 | + |
| 189 | + @python_api_test |
| 190 | + def test_SBSymbolContext(self): |
| 191 | + obj = lldb.SBSymbolContext() |
| 192 | + if self.TraceOn(): |
| 193 | + print obj |
| 194 | + self.assertFalse(obj) |
| 195 | + |
| 196 | + @python_api_test |
| 197 | + def test_SBSymbolContextList(self): |
| 198 | + obj = lldb.SBSymbolContextList() |
| 199 | + if self.TraceOn(): |
| 200 | + print obj |
| 201 | + self.assertFalse(obj) |
| 202 | + |
| 203 | + @python_api_test |
| 204 | + def test_SBTarget(self): |
| 205 | + obj = lldb.SBTarget() |
| 206 | + if self.TraceOn(): |
| 207 | + print obj |
| 208 | + self.assertFalse(obj) |
| 209 | + |
| 210 | + @python_api_test |
| 211 | + def test_SBThread(self): |
| 212 | + obj = lldb.SBThread() |
| 213 | + if self.TraceOn(): |
| 214 | + print obj |
| 215 | + self.assertFalse(obj) |
| 216 | + |
| 217 | + @python_api_test |
| 218 | + def test_SBType(self): |
| 219 | + obj = lldb.SBType() |
| 220 | + if self.TraceOn(): |
| 221 | + print obj |
| 222 | + self.assertFalse(obj) |
| 223 | + |
| 224 | + @python_api_test |
| 225 | + def test_SBValue(self): |
| 226 | + obj = lldb.SBValue() |
| 227 | + if self.TraceOn(): |
| 228 | + print obj |
| 229 | + self.assertFalse(obj) |
| 230 | + |
| 231 | + @python_api_test |
| 232 | + def test_SBValueList(self): |
| 233 | + obj = lldb.SBValueList() |
| 234 | + if self.TraceOn(): |
| 235 | + print obj |
| 236 | + self.assertFalse(obj) |
| 237 | + |
| 238 | + |
| 239 | +if __name__ == '__main__': |
| 240 | + import atexit |
| 241 | + lldb.SBDebugger.Initialize() |
| 242 | + atexit.register(lambda: lldb.SBDebugger.Terminate()) |
| 243 | + unittest2.main() |
0 commit comments