2 Test lldb log handlers.
7 from lldbsuite
.test
.decorators
import *
8 from lldbsuite
.test
.lldbtest
import *
9 from lldbsuite
.test
import lldbutil
12 class LogHandlerTestCase(TestBase
):
13 NO_DEBUG_INFO_TESTCASE
= True
17 self
.log_file
= self
.getBuildArtifact("log-file.txt")
18 if os
.path
.exists(self
.log_file
):
19 os
.remove(self
.log_file
)
21 def test_circular(self
):
22 self
.runCmd("log enable -b 5 -h circular lldb commands")
23 self
.runCmd("bogus", check
=False)
24 self
.runCmd("log dump lldb -f {}".format(self
.log_file
))
26 with
open(self
.log_file
, "r") as f
:
27 log_lines
= f
.readlines()
29 self
.assertEqual(len(log_lines
), 5)
31 found_command_log_dump
= False
32 found_command_bogus
= False
34 for line
in log_lines
:
35 if "Processing command: log dump" in line
:
36 found_command_log_dump
= True
37 if "Processing command: bogus" in line
:
38 found_command_bogus
= True
40 self
.assertTrue(found_command_log_dump
)
41 self
.assertFalse(found_command_bogus
)
43 def test_circular_no_buffer_size(self
):
45 "log enable -h circular lldb commands",
47 substrs
=["the circular buffer handler requires a non-zero buffer size"],
50 def test_dump_unsupported(self
):
51 self
.runCmd("log enable lldb commands -f {}".format(self
.log_file
))
55 substrs
=["log channel 'lldb' does not support dumping"],