2 Test DarwinLog "source include debug-level" functionality provided by the
3 StructuredDataDarwinLog plugin.
5 These tests are currently only supported when running against Darwin
12 from lldbsuite.test import decorators
13 from lldbsuite.test import lldbtest
14 from lldbsuite.test import darwin_log
17 class TestDarwinLogSourceDebug(darwin_log.DarwinLogTestBase):
19 mydir = lldbtest.TestBase.compute_mydir(__file__)
22 # Call super's setUp().
23 super(TestDarwinLogSourceDebug, self).setUp()
26 self.source = 'main.c'
29 self.exe_name = self.getBuildArtifact("a.out")
30 self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
33 self.line = lldbtest.line_number(self.source, '// break here')
35 # Indicate we want strict-sources behavior.
36 self.strict_sources = True
39 # Shut down the process if it's still running.
41 self.runCmd('process kill')
46 super(TestDarwinLogSourceDebug, self).tearDown()
48 # ==========================================================================
49 # source include/exclude debug filter tests
50 # ==========================================================================
52 @decorators.skipUnlessDarwin
53 def test_source_default_exclude_debug(self):
54 """Test that default excluding of debug-level log messages works."""
57 # We should only see the second log message as the first is a
58 # debug-level message and we're not including debug-level messages.
59 self.assertIsNotNone(self.child.match)
62 self.child.match.groups()) > 1) and (
63 self.child.match.group(2) == "cat2"),
64 "first log line should not be present, second log line "
67 @decorators.skipUnlessDarwin
68 def test_source_explicitly_include_debug(self):
69 """Test that explicitly including debug-level log messages works."""
70 self.do_test(["--debug"])
72 # We should only see the second log message as the first is a
73 # debug-level message and we're not including debug-level messages.
74 self.assertIsNotNone(self.child.match)
75 self.assertTrue((len(self.child.match.groups()) > 1) and
76 (self.child.match.group(2) == "cat1"),
77 "first log line should be present since we're "
78 "including debug-level log messages")