8 import lldbsuite
.test
.lldbutil
as lldbutil
9 from lldbsuite
.test
.lldbtest
import *
12 class APILogTestCase(TestBase
):
13 NO_DEBUG_INFO_TESTCASE
= True
15 def test_api_log(self
):
16 """Test API logging"""
17 logfile
= self
.getBuildArtifact("api-log.txt")
19 self
.expect("log enable lldb api -f {}".format(logfile
))
21 self
.dbg
.SetDefaultArchitecture(None)
22 self
.dbg
.GetScriptingLanguage(None)
23 target
= self
.dbg
.CreateTarget(None)
25 self
.assertTrue(os
.path
.isfile(logfile
))
26 with
open(logfile
, "r") as f
:
29 # Find the SBDebugger's address.
30 debugger_addr
= re
.findall(
31 r
"lldb::SBDebugger::GetScriptingLanguage\([^)]*\) \(0x([0-9a-fA-F]+),", log
34 # Make sure we've found a match.
35 self
.assertTrue(debugger_addr
, log
)
37 # Make sure the GetScriptingLanguage matches.
40 r
'lldb::SBDebugger::GetScriptingLanguage\([^)]*\) \(0x{}, ""\)'.format(
48 # Make sure the address matches.
51 r
'lldb::SBDebugger::CreateTarget\([^)]*\) \(0x{}, ""\)'.format(