1"""
2Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
3plugin.
4
5These tests are currently only supported when running against Darwin
6targets.
7"""
8
9# System imports
10
11# LLDB imports
12from lldbsuite.test import darwin_log
13from lldbsuite.test import decorators
14from lldbsuite.test import lldbtest
15
16
17class TestDarwinLogBasic(darwin_log.DarwinLogEventBasedTestBase):
18
19    mydir = lldbtest.TestBase.compute_mydir(__file__)
20
21    @decorators.add_test_categories(['pyapi'])
22    @decorators.skipUnlessDarwin
23    @decorators.expectedFailureAll(archs=["i386"], bugnumber="rdar://28655626")
24    @decorators.expectedFailureAll(bugnumber="rdar://30645203")
25    def test_SBStructuredData_gets_broadcasted(self):
26        """Exercise SBStructuredData API."""
27
28        # Run the test.
29        log_entries = self.do_test(None, max_entry_count=2)
30
31        # Validate that we received our two log entries.
32        self.assertEqual(len(log_entries), 1,
33                         "Expected one log entry to arrive via events.")
34        self.assertEqual(log_entries[0]['message'], "Hello, world",
35                         "Log message should match expected content.")
36