[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / packages / Python / lldbsuite / test / api / log / TestAPILog.py
blobc0ffa2c6f50931fedf2be27a0a54f13998f3bb0d
1 """
2 Test API logging.
3 """
5 import re
7 import lldb
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")
22 def cleanup():
23 if os.path.exists(logfile):
24 os.unlink(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)
33 print(logfile)
34 with open(logfile, 'r') as f:
35 log = f.read()
37 # Find the SBDebugger's address.
38 debugger_addr = re.findall(
39 r"lldb::SBDebugger::GetScriptingLanguage\([^)]*\) \(0x([0-9a-fA-F]+),",
40 log)
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)