[Lldb-commits] [lldb] [lldb] For a host socket, add a method to print the listening address. (PR #118330)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 3 10:23:03 PST 2024
================
@@ -88,6 +88,28 @@ TEST_P(SocketTest, DomainListenConnectAccept) {
CreateDomainConnectedSockets(Path, &socket_a_up, &socket_b_up);
}
+TEST_P(SocketTest, DomainListenGetListeningConnectionURI) {
+ llvm::SmallString<64> Path;
+ std::error_code EC =
+ llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", Path);
+ ASSERT_FALSE(EC);
+ llvm::sys::path::append(Path, "test");
+
+ // Skip the test if the $TMPDIR is too long to hold a domain socket.
+ if (Path.size() > 107u)
+ return;
+
+ auto listen_socket_up = std::make_unique<DomainSocket>(
+ /*should_close=*/true);
+ Status error = listen_socket_up->Listen(Path, 5);
+ ASSERT_THAT_ERROR(error.ToError(), llvm::Succeeded());
+ ASSERT_TRUE(listen_socket_up->IsValid());
+
+ const auto &URIs = listen_socket_up->GetListeningConnectionURI();
+ ASSERT_EQ(URIs.size(), 1u);
+ ASSERT_EQ(URIs[0], llvm::formatv("unix-connect://{0}", Path).str());
----------------
ashgti wrote:
Applied suggestion
https://github.com/llvm/llvm-project/pull/118330
More information about the lldb-commits
mailing list