2 Test DarwinLog "source include info-level" functionality provided by the
3 StructuredDataDarwinLog plugin.
5 These tests are currently only supported when running against Darwin
9 from __future__ import print_function
15 from lldbsuite.test import decorators
16 from lldbsuite.test import lldbtest
17 from lldbsuite.test import darwin_log
20 class TestDarwinLogSourceInfo(darwin_log.DarwinLogTestBase):
22 mydir = lldbtest.TestBase.compute_mydir(__file__)
25 # Call super's setUp().
26 super(TestDarwinLogSourceInfo, self).setUp()
29 self.source = 'main.c'
32 self.exe_name = 'a.out'
33 self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
36 self.line = lldbtest.line_number(self.source, '// break here')
38 # Indicate we want strict-sources behavior.
39 self.strict_sources = True
42 # Shut down the process if it's still running.
44 self.runCmd('process kill')
49 super(TestDarwinLogSourceInfo, self).tearDown()
51 # ==========================================================================
52 # source include/exclude debug filter tests
53 # ==========================================================================
55 @decorators.skipUnlessDarwin
56 @decorators.expectedFailureAll(bugnumber="rdar://27316264")
57 def test_source_exclude_info_level(self):
58 """Test that default excluding of info-level log messages works."""
61 # We should only see the second log message as the first is an
62 # info-level message and we're not including debug-level messages.
63 self.assertIsNotNone(self.child.match)
66 self.child.match.groups()) > 1) and (
67 self.child.match.group(2) == "cat2"),
68 "first log line should not be present, second log line "
71 @decorators.skipUnlessDarwin
72 def test_source_include_info_level(self):
73 """Test that explicitly including info-level log messages works."""
78 # We should only see the second log message as the first is a
79 # debug-level message and we're not including debug-level messages.
80 self.assertIsNotNone(self.child.match)
81 self.assertTrue((len(self.child.match.groups()) > 1) and
82 (self.child.match.group(2) == "cat1"),
83 "first log line should be present since we're "
84 "including info-level log messages")