Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / api / log / TestAPILog.py
blob77f154d35222403fc08e95d6ec6312be23dbeeb5
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):
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:
27 log = f.read()
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.
38 self.assertTrue(
39 re.search(
40 r'lldb::SBDebugger::GetScriptingLanguage\([^)]*\) \(0x{}, ""\)'.format(
41 debugger_addr[0]
43 log,
45 log,
48 # Make sure the address matches.
49 self.assertTrue(
50 re.search(
51 r'lldb::SBDebugger::CreateTarget\([^)]*\) \(0x{}, ""\)'.format(
52 debugger_addr[0]
54 log,
56 log,