diff options
Diffstat (limited to 'lldb/unittests/Process')
5 files changed, 6 insertions, 41 deletions
diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp index 8ab0afdb9be..187f1b2db9a 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp @@ -48,7 +48,8 @@ struct TestClient : public GDBRemoteClientBase { class GDBRemoteClientBaseTest : public GDBRemoteTest { public: void SetUp() override { - ASSERT_THAT_ERROR(Connect(client, server), llvm::Succeeded()); + ASSERT_THAT_ERROR(GDBRemoteCommunication::ConnectLocally(client, server), + llvm::Succeeded()); ASSERT_EQ(TestClient::eBroadcastBitRunPacketSent, listener_sp->StartListeningForEvents( &client, TestClient::eBroadcastBitRunPacketSent)); diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 6742f1e0828..bf31f958b96 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -63,7 +63,8 @@ std::string one_register_hex = "41424344"; class GDBRemoteCommunicationClientTest : public GDBRemoteTest { public: void SetUp() override { - ASSERT_THAT_ERROR(Connect(client, server), llvm::Succeeded()); + ASSERT_THAT_ERROR(GDBRemoteCommunication::ConnectLocally(client, server), + llvm::Succeeded()); } protected: diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp index 5ae8e700757..fd3e93797d2 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp @@ -30,7 +30,8 @@ public: class GDBRemoteCommunicationTest : public GDBRemoteTest { public: void SetUp() override { - ASSERT_THAT_ERROR(Connect(client, server), llvm::Succeeded()); + ASSERT_THAT_ERROR(GDBRemoteCommunication::ConnectLocally(client, server), + llvm::Succeeded()); } protected: diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp index 2acf72744d2..f698fdd796d 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp @@ -9,11 +9,6 @@ #include "GDBRemoteTestUtils.h" -#include "lldb/Host/common/TCPSocket.h" -#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h" - -#include <future> - namespace lldb_private { namespace process_gdb_remote { @@ -30,34 +25,5 @@ void GDBRemoteTest::TearDownTestCase() { #endif } -llvm::Error GDBRemoteTest::Connect(GDBRemoteCommunication &client, - GDBRemoteCommunication &server) { - bool child_processes_inherit = false; - TCPSocket listen_socket(true, child_processes_inherit); - if (llvm::Error error = listen_socket.Listen("127.0.0.1:0", 5).ToError()) - return error; - - Socket *accept_socket; - std::future<Status> accept_status = std::async( - std::launch::async, [&] { return listen_socket.Accept(accept_socket); }); - - llvm::SmallString<32> remote_addr; - llvm::raw_svector_ostream(remote_addr) - << "connect://localhost:" << listen_socket.GetLocalPortNumber(); - - std::unique_ptr<ConnectionFileDescriptor> conn_up( - new ConnectionFileDescriptor()); - if (conn_up->Connect(remote_addr, nullptr) != lldb::eConnectionStatusSuccess) - return llvm::make_error<llvm::StringError>("Unable to connect", - llvm::inconvertibleErrorCode()); - - client.SetConnection(conn_up.release()); - if (llvm::Error error = accept_status.get().ToError()) - return error; - - server.SetConnection(new ConnectionFileDescriptor(accept_socket)); - return llvm::Error::success(); -} - } // namespace process_gdb_remote } // namespace lldb_private diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h index cc17422049b..90f95932c64 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h @@ -20,10 +20,6 @@ class GDBRemoteTest : public testing::Test { public: static void SetUpTestCase(); static void TearDownTestCase(); - -protected: - llvm::Error Connect(GDBRemoteCommunication &client, - GDBRemoteCommunication &server); }; struct MockServer : public GDBRemoteCommunicationServer { |