Windows: full module parity and runtime-qualified test suite
- Net/IO: Winsock sockets (UdpSocket, TlsClientStream, WebSocketClient), HttpServer port with a loopback wake socket replacing eventfd, and the select-based IO backend built on Windows (ws2_32). - Net: implement StaticFileResolver::open_safe and OpenedStaticFile on Windows (reparse-point rejection plus canonical containment check on the opened handle) and widen native handles to intptr_t. - Plugin: hot reload works on Windows by loading a fresh copy while the old DLL stays mapped; enable the reload, discovery and FSM service reload tests and retire the plugin file by rename instead of replacement. - Update: activation pointer as a directory junction on Windows. - Stacktrace: portable path comparison for wide native strings. - Docs/targets: every module allowlisted on Windows; record the Wine run (2000 tests, 1977 passed, 23 skipped, 0 failed). - CMake: add -Wa,-mbig-obj for GNU MinGW targets (COFF section limit). - Async: fix the FuturePool stopped-after-close test to wait for the executor to release its admission slot instead of racing it. Windows and Linux suites both pass: Windows 2000/1977/23 skips/0 failed, Linux 2027/2023/4 skips/0 failed.
This commit is contained in:
1 parent
1b1947340f
commit
b3c959b920
32 files changed
+1836
-401
No files matched your search
@@ -4,10 +4,24 @@
|
||||
#include <Void/Testing/Assert.hpp>
|
||||
#include <Void/Testing/Test.hpp>
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#ifndef SHUT_WR
|
||||
#define SHUT_WR SD_SEND
|
||||
#endif
|
||||
#else
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
@@ -31,9 +45,18 @@ namespace
|
||||
using Void::Net::ServerRequest;
|
||||
using Void::Net::ServerResponse;
|
||||
|
||||
void close_socket(int fd) noexcept
|
||||
{
|
||||
#ifdef _WIN32
|
||||
(void)::closesocket(static_cast<SOCKET>(fd));
|
||||
#else
|
||||
(void)::close(fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string raw_http_exchange(std::uint16_t port, std::string_view raw_req)
|
||||
{
|
||||
const int fd = ::socket(AF_INET, SOCK_STREAM, 0);
|
||||
const int fd = static_cast<int>(::socket(AF_INET, SOCK_STREAM, 0));
|
||||
Void::Testing::require(fd >= 0);
|
||||
|
||||
sockaddr_in addr{};
|
||||
@@ -46,7 +69,7 @@ namespace
|
||||
|
||||
std::size_t off = 0;
|
||||
while (off < raw_req.size()) {
|
||||
const ssize_t w =
|
||||
const std::ptrdiff_t w =
|
||||
::send(fd, raw_req.data() + off, raw_req.size() - off, 0);
|
||||
Void::Testing::require(w > 0);
|
||||
off += static_cast<std::size_t>(w);
|
||||
@@ -56,13 +79,13 @@ namespace
|
||||
std::string out;
|
||||
std::array<char, 4096> buf{};
|
||||
for (;;) {
|
||||
const ssize_t r = ::recv(fd, buf.data(), buf.size(), 0);
|
||||
const std::ptrdiff_t r = ::recv(fd, buf.data(), buf.size(), 0);
|
||||
if (r <= 0) {
|
||||
break;
|
||||
}
|
||||
out.append(buf.data(), static_cast<std::size_t>(r));
|
||||
}
|
||||
(void)::close(fd);
|
||||
close_socket(fd);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -230,7 +253,7 @@ Void::Testing::Test http_server_ephemeral_methods_and_concurrent_dispatch()
|
||||
Void::Testing::expect_eq(server.bound_port(), std::uint16_t{0});
|
||||
|
||||
// No dangling listening socket after shutdown().
|
||||
const int probe = ::socket(AF_INET, SOCK_STREAM, 0);
|
||||
const int probe = static_cast<int>(::socket(AF_INET, SOCK_STREAM, 0));
|
||||
Void::Testing::require(probe >= 0);
|
||||
sockaddr_in addr{};
|
||||
addr.sin_family = AF_INET;
|
||||
@@ -239,7 +262,7 @@ Void::Testing::Test http_server_ephemeral_methods_and_concurrent_dispatch()
|
||||
Void::Testing::expect(
|
||||
::connect(probe, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) !=
|
||||
0);
|
||||
(void)::close(probe);
|
||||
close_socket(probe);
|
||||
}
|
||||
|
||||
Void::Testing::Test http_server_limits_smuggling_streaming_and_graceful_drain()
|
||||
|
||||
Reference in new issue
Block a user