8 import lldbsuite
.test
.lldbutil
as lldbutil
9 from lldbsuite
.test
.lldbtest
import *
12 class APILogTestCase(TestBase
):
14 mydir
= TestBase
.compute_mydir(__file__
)
16 NO_DEBUG_INFO_TESTCASE
= True
18 def test_api_log(self
):
19 """Test API logging"""
20 logfile
= os
.path
.join(self
.getBuildDir(), "api-log.txt")
23 if os
.path
.exists(logfile
):
26 self
.addTearDownHook(cleanup
)
27 self
.expect("log enable lldb api -f {}".format(logfile
))
29 self
.dbg
.SetDefaultArchitecture(None)
30 self
.dbg
.GetScriptingLanguage(None)
31 target
= self
.dbg
.CreateTarget(None)
34 with
open(logfile
, 'r') as f
:
37 # Find the SBDebugger's address.
38 debugger_addr
= re
.findall(
39 r
"lldb::SBDebugger::GetScriptingLanguage\([^)]*\) \(0x([0-9a-fA-F]+),",
42 # Make sure we've found a match.
43 self
.assertTrue(debugger_addr
, log
)
45 # Make sure the GetScriptingLanguage matches.
46 self
.assertTrue(re
.search(r
'lldb::SBDebugger::GetScriptingLanguage\([^)]*\) \(0x{}, ""\)'.format(
47 debugger_addr
[0]), log
), log
)
49 # Make sure the address matches.
50 self
.assertTrue(re
.search(r
'lldb::SBDebugger::CreateTarget\([^)]*\) \(0x{}, ""\)'.format(
51 debugger_addr
[0]), log
), log
)