<commit_before>"""
Test lldb 'process connect' command.
"""

import os
import unittest2
import lldb
import pexpect
from lldbtest import *

class ConnectRemoteTestCase(TestBase):

    mydir = TestBase.compute_mydir(__file__)

    def test_connect_remote(self):
        """Test "process connect connect:://localhost:12345"."""

        # First, we'll start a fake debugserver (a simple echo server).
        fakeserver = pexpect.spawn('./EchoServer.py')

        # Turn on logging for what the child sends back.
        if self.TraceOn():
            fakeserver.logfile_read = sys.stdout

        # Schedule the fake debugserver to be shutting down during teardown.
        def shutdown_fakeserver():
            fakeserver.close()
        self.addTearDownHook(shutdown_fakeserver)

        # Wait until we receive the server ready message before continuing.
        fakeserver.expect_exact('Listening on localhost:12345')

        # Connect to the fake server....
        if sys.platform.startswith('freebsd') or sys.platform.startswith("linux"):
            self.runCmd("process connect -p gdb-remote connect://localhost:12345")
        else:
            self.runCmd("process connect connect://localhost:12345")


if __name__ == '__main__':
    import atexit
    lldb.SBDebugger.Initialize()
    atexit.register(lambda: lldb.SBDebugger.Terminate())
    unittest2.main()
<commit_msg>Add decorator for GDB connect test failing on FreeBSD<commit_after>"""
Test lldb 'process connect' command.
"""

import os
import unittest2
import lldb
import pexpect
from lldbtest import *

class ConnectRemoteTestCase(TestBase):

    mydir = TestBase.compute_mydir(__file__)

    @expectedFailureFreeBSD('llvm.org/pr18313')
    def test_connect_remote(self):
        """Test "process connect connect:://localhost:12345"."""

        # First, we'll start a fake debugserver (a simple echo server).
        fakeserver = pexpect.spawn('./EchoServer.py')

        # Turn on logging for what the child sends back.
        if self.TraceOn():
            fakeserver.logfile_read = sys.stdout

        # Schedule the fake debugserver to be shutting down during teardown.
        def shutdown_fakeserver():
            fakeserver.close()
        self.addTearDownHook(shutdown_fakeserver)

        # Wait until we receive the server ready message before continuing.
        fakeserver.expect_exact('Listening on localhost:12345')

        # Connect to the fake server....
        if sys.platform.startswith('freebsd') or sys.platform.startswith("linux"):
            self.runCmd("process connect -p gdb-remote connect://localhost:12345")
        else:
            self.runCmd("process connect connect://localhost:12345")


if __name__ == '__main__':
    import atexit
    lldb.SBDebugger.Initialize()
    atexit.register(lambda: lldb.SBDebugger.Terminate())
    unittest2.main()

{'fraction_non_alphanumeric': 0.09992987377279103, 'fraction_numerical': 0.017180925666199158, 'mean_word_length': 3.0410764872521248, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1560692', 'n_tokens_mistral': 873, 'n_tokens_neox': 811, 'n_words': 221}