summaryrefslogtreecommitdiffstats
path: root/lldb/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/unittests')
-rw-r--r--lldb/unittests/Host/SocketTest.cpp21
-rw-r--r--lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp5
-rw-r--r--lldb/unittests/debugserver/RNBSocketTest.cpp2
3 files changed, 20 insertions, 8 deletions
diff --git a/lldb/unittests/Host/SocketTest.cpp b/lldb/unittests/Host/SocketTest.cpp
index 7abb010a908..eda3a11fc10 100644
--- a/lldb/unittests/Host/SocketTest.cpp
+++ b/lldb/unittests/Host/SocketTest.cpp
@@ -44,8 +44,7 @@ protected:
const char *listen_remote_address,
bool child_processes_inherit, Socket **accept_socket,
Error *error) {
- *error = listen_socket->Accept(listen_remote_address,
- child_processes_inherit, *accept_socket);
+ *error = listen_socket->Accept(*accept_socket);
}
template <typename SocketType>
@@ -56,7 +55,7 @@ protected:
bool child_processes_inherit = false;
Error error;
std::unique_ptr<SocketType> listen_socket_up(
- new SocketType(child_processes_inherit, error));
+ new SocketType(true, child_processes_inherit));
EXPECT_FALSE(error.Fail());
error = listen_socket_up->Listen(listen_remote_address, 5);
EXPECT_FALSE(error.Fail());
@@ -70,7 +69,7 @@ protected:
std::string connect_remote_address = get_connect_addr(*listen_socket_up);
std::unique_ptr<SocketType> connect_socket_up(
- new SocketType(child_processes_inherit, error));
+ new SocketType(true, child_processes_inherit));
EXPECT_FALSE(error.Fail());
error = connect_socket_up->Connect(connect_remote_address);
EXPECT_FALSE(error.Fail());
@@ -141,6 +140,20 @@ TEST_F(SocketTest, DecodeHostAndPort) {
EXPECT_STREQ("65535", port_str.c_str());
EXPECT_EQ(65535, port);
EXPECT_TRUE(error.Success());
+
+ EXPECT_TRUE(
+ Socket::DecodeHostAndPort("[::1]:12345", host_str, port_str, port, &error));
+ EXPECT_STREQ("::1", host_str.c_str());
+ EXPECT_STREQ("12345", port_str.c_str());
+ EXPECT_EQ(12345, port);
+ EXPECT_TRUE(error.Success());
+
+ EXPECT_TRUE(
+ Socket::DecodeHostAndPort("[abcd:12fg:AF58::1]:12345", host_str, port_str, port, &error));
+ EXPECT_STREQ("abcd:12fg:AF58::1", host_str.c_str());
+ EXPECT_STREQ("12345", port_str.c_str());
+ EXPECT_EQ(12345, port);
+ EXPECT_TRUE(error.Success());
}
#ifndef LLDB_DISABLE_POSIX
diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
index 08501f50f65..6440e814efd 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp
@@ -33,15 +33,14 @@ void GDBRemoteTest::TearDownTestCase() {
void Connect(GDBRemoteCommunication &client, GDBRemoteCommunication &server) {
bool child_processes_inherit = false;
Error error;
- TCPSocket listen_socket(child_processes_inherit, error);
+ TCPSocket listen_socket(true, child_processes_inherit);
ASSERT_FALSE(error.Fail());
error = listen_socket.Listen("127.0.0.1:0", 5);
ASSERT_FALSE(error.Fail());
Socket *accept_socket;
std::future<Error> accept_error = std::async(std::launch::async, [&] {
- return listen_socket.Accept("127.0.0.1:0", child_processes_inherit,
- accept_socket);
+ return listen_socket.Accept(accept_socket);
});
char connect_remote_address[64];
diff --git a/lldb/unittests/debugserver/RNBSocketTest.cpp b/lldb/unittests/debugserver/RNBSocketTest.cpp
index 997041f6154..2b84665bc96 100644
--- a/lldb/unittests/debugserver/RNBSocketTest.cpp
+++ b/lldb/unittests/debugserver/RNBSocketTest.cpp
@@ -96,7 +96,7 @@ void TestSocketConnect(const char *addr) {
ASSERT_EQ(bye, goodbye);
} else {
Socket *connected_socket;
- err = server_socket->Accept(addr_wrap, false, connected_socket);
+ err = server_socket->Accept(connected_socket);
if (err.Fail()) {
llvm::errs() << err.AsCString();
abort();
OpenPOWER on IntegriCloud