Files
mscclpp/test/unit/socket_tests.cc
Copilot 93f6eeaa6b Remove GTest dependency, add code coverage, and refactor unit tests and CI pipelines (#744)
- Removes the GTest dependency, replacing it with a minimal custom
framework (`test/framework.*`) that covers only what the tests actually
use — a unified `TEST()` macro with SFINAE-based fixture auto-detection,
`EXPECT_*`/`ASSERT_*` assertions, environments, and setup/teardown.
- `--exclude-perf-tests` flag and substring-based negative filtering
- `MSCCLPP_ENABLE_COVERAGE` CMake option with gcov/lcov; CI uploads to
Codecov
- Merges standalone `test/perf/` into main test targets
- Refactors Azure pipelines to reduce redundancies & make more readable

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Changho Hwang <changhohwang@microsoft.com>
2026-03-24 23:34:38 -04:00

32 lines
700 B
C++

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include <mscclpp/utils.hpp>
#include <thread>
#include "../framework.hpp"
#include "socket.h"
#include "utils_internal.hpp"
TEST(Socket, ListenAndConnect) {
mscclpp::Timer timeout(3);
std::string ipPortPair = "127.0.0.1:51512";
mscclpp::SocketAddress listenAddr;
ASSERT_NO_THROW(mscclpp::SocketGetAddrFromString(&listenAddr, ipPortPair.c_str()));
mscclpp::Socket listenSock(&listenAddr);
listenSock.bindAndListen();
std::thread clientThread([&listenAddr]() {
mscclpp::Socket sock(&listenAddr);
sock.connect();
});
mscclpp::Socket sock;
sock.accept(&listenSock);
clientThread.join();
}