18fa2394bSMichał Górnyimport lldb
28fa2394bSMichał Górnyfrom lldbsuite.test.lldbtest import *
38fa2394bSMichał Górnyfrom lldbsuite.test.decorators import *
48fa2394bSMichał Górnyfrom gdbclientutils import *
58fa2394bSMichał Górny
68fa2394bSMichał Górny
78fa2394bSMichał Górny@skipIfWindows
88fa2394bSMichał Górnyclass TestPty(GDBRemoteTestBase):
98fa2394bSMichał Górny    mydir = TestBase.compute_mydir(__file__)
108fa2394bSMichał Górny    server_socket_class = PtyServerSocket
118fa2394bSMichał Górny
128fa2394bSMichał Górny    def test_process_connect_sync(self):
138fa2394bSMichał Górny        """Test the process connect command in synchronous mode"""
148fa2394bSMichał Górny        try:
158fa2394bSMichał Górny            self.dbg.SetAsync(False)
168fa2394bSMichał Górny            self.expect("platform select remote-gdb-server",
178fa2394bSMichał Górny                        substrs=['Platform: remote-gdb-server', 'Connected: no'])
188fa2394bSMichał Górny            self.expect("process connect " + self.server.get_connect_url(),
198fa2394bSMichał Górny                        substrs=['Process', 'stopped'])
208fa2394bSMichał Górny        finally:
21*45f97950SMichał Górny            self.dbg.GetSelectedTarget().GetProcess().Kill()
228fa2394bSMichał Górny
238fa2394bSMichał Górny    def test_process_connect_async(self):
248fa2394bSMichał Górny        """Test the process connect command in asynchronous mode"""
258fa2394bSMichał Górny        try:
268fa2394bSMichał Górny            self.dbg.SetAsync(True)
278fa2394bSMichał Górny            self.expect("platform select remote-gdb-server",
288fa2394bSMichał Górny                        substrs=['Platform: remote-gdb-server', 'Connected: no'])
298fa2394bSMichał Górny            self.expect("process connect " + self.server.get_connect_url(),
308fa2394bSMichał Górny                        matching=False,
318fa2394bSMichał Górny                        substrs=['Process', 'stopped'])
328fa2394bSMichał Górny            lldbutil.expect_state_changes(self, self.dbg.GetListener(),
338fa2394bSMichał Górny                                          self.process(), [lldb.eStateStopped])
348fa2394bSMichał Górny        finally:
35*45f97950SMichał Górny            self.dbg.GetSelectedTarget().GetProcess().Kill()
36*45f97950SMichał Górny        lldbutil.expect_state_changes(self, self.dbg.GetListener(),
37*45f97950SMichał Górny                                      self.process(), [lldb.eStateExited])
38