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:
faumaray committed 2026-12-06 14:56:26 +03:00
1 parent 1b1947340f
commit b3c959b920
32 files changed
+1836 -401

No files matched your search

+30 -12
View File
@@ -1,6 +1,4 @@
#include <Void/Plugin/Loader.hpp>
// @requires-posix: plugin discovery reloads stateful DLLs, which Windows
// cannot unload-and-reload yet.
#include <Void/Plugin/Manager.hpp>
#include <Void/System/TempDir.hpp>
#include <Void/Testing/Assert.hpp>
@@ -14,12 +12,22 @@ using namespace Void::Plugin;
#if defined(VOID_TEST_PLUGIN_PATH) && defined(VOID_STATEFUL_V1_PATH)
namespace
{
#if defined(_WIN32)
constexpr std::string_view kPluginExtension = ".dll";
#else
constexpr std::string_view kPluginExtension = ".so";
#endif
} // namespace
Void::Testing::Test discovery_loads_all_plugins_in_filename_order()
{
Void::FileSystem::TempDir tmp{"void_disc"};
std::filesystem::copy_file(VOID_STATEFUL_V1_PATH,
tmp.path() / "b_stateful.so");
std::filesystem::copy_file(VOID_TEST_PLUGIN_PATH, tmp.path() / "a_test.so");
tmp.path() / ("b_stateful" + std::string{kPluginExtension}));
std::filesystem::copy_file(VOID_TEST_PLUGIN_PATH,
tmp.path() / ("a_test" + std::string{kPluginExtension}));
{
std::ofstream decoy{tmp.path() / "readme.txt"};
decoy << "not a plugin";
@@ -29,14 +37,19 @@ Void::Testing::Test discovery_loads_all_plugins_in_filename_order()
PluginManager mgr;
const auto results = mgr.load_directory(tmp.path());
// Only the two .so files count, sorted by filename.
// Only the two plugin files count, sorted by filename.
Void::Testing::expect_eq(results.size(), std::size_t{2});
Void::Testing::expect_eq(results[0].first.filename().string(),
std::string{"a_test.so"});
if (results.size() != 2) {
return;
}
Void::Testing::expect_eq(
results[0].first.filename().string(),
std::string{"a_test"} + std::string{kPluginExtension});
Void::Testing::expect(results[0].second.has_value());
Void::Testing::expect_eq(*results[0].second, std::string{"TestPlugin"});
Void::Testing::expect_eq(results[1].first.filename().string(),
std::string{"b_stateful.so"});
Void::Testing::expect_eq(
results[1].first.filename().string(),
std::string{"b_stateful"} + std::string{kPluginExtension});
Void::Testing::expect(results[1].second.has_value());
Void::Testing::expect_eq(*results[1].second, std::string{"StatefulPlugin"});
@@ -47,9 +60,11 @@ Void::Testing::Test discovery_loads_all_plugins_in_filename_order()
Void::Testing::Test discovery_reports_per_file_errors()
{
Void::FileSystem::TempDir tmp{"void_disc"};
std::filesystem::copy_file(VOID_TEST_PLUGIN_PATH, tmp.path() / "ok.so");
std::filesystem::copy_file(VOID_TEST_PLUGIN_PATH,
tmp.path() / ("ok" + std::string{kPluginExtension}));
{
std::ofstream bogus{tmp.path() / "broken.so"};
std::ofstream bogus{tmp.path() /
("broken" + std::string{kPluginExtension})};
bogus << "ELF? no.";
}
@@ -57,7 +72,10 @@ Void::Testing::Test discovery_reports_per_file_errors()
const auto results = mgr.load_directory(tmp.path());
Void::Testing::expect_eq(results.size(), std::size_t{2});
// broken.so sorts first and fails to dlopen; ok.so loads.
if (results.size() != 2) {
return;
}
// broken sorts first and fails to dlopen; ok loads.
Void::Testing::expect(!results[0].second.has_value());
Void::Testing::expect(results[0].second.error() == LoadError::DlopenFailed);
Void::Testing::expect(results[1].second.has_value());
@@ -27,6 +27,15 @@ namespace
staging += ".incoming";
std::filesystem::copy_file(
src, staging, std::filesystem::copy_options::overwrite_existing);
#ifdef _WIN32
// A loaded image can be renamed away but not replaced in place.
std::error_code error;
auto retired = dst;
retired += ".old";
std::filesystem::remove(retired, error);
error.clear();
std::filesystem::rename(dst, retired, error);
#endif
std::filesystem::rename(staging, dst);
}
} // namespace
@@ -34,9 +43,6 @@ namespace
// @tag stress, concurrency
Void::Testing::Test hot_reload_under_concurrent_load()
{
#ifdef _WIN32
Void::Testing::skip("plugin hot reload is not supported on Windows yet");
#endif
Void::FileSystem::TempDir tmp{"void_hotload"};
const auto so = tmp.path() / "plugin.so";
std::filesystem::copy_file(VOID_STATEFUL_V1_PATH, so);
+10 -12
View File
@@ -33,6 +33,16 @@ namespace
staging += ".incoming";
std::filesystem::copy_file(
src, staging, std::filesystem::copy_options::overwrite_existing);
#ifdef _WIN32
// Windows keeps a loaded image locked against replacement, but it can
// be renamed away; the old generation stays mapped under the new name.
std::error_code error;
auto retired = dst;
retired += ".old";
std::filesystem::remove(retired, error);
error.clear();
std::filesystem::rename(dst, retired, error);
#endif
std::filesystem::rename(staging, dst);
}
} // namespace
@@ -97,9 +107,6 @@ Void::Testing::Test manager_candidate_validator_rejects_reload_transactionally()
Void::Testing::Test manager_reload_migrates_v1_state_to_v2()
{
#ifdef _WIN32
Void::Testing::skip("plugin reload is not supported on Windows yet");
#endif
// Copy v1 into a temp path we control, then overwrite with v2 and
// reload — exactly the in-place upgrade a deployment performs.
Void::FileSystem::TempDir tmp{"void_mgr"};
@@ -163,9 +170,6 @@ Void::Testing::Test manager_replace_failure_keeps_current_generation()
Void::Testing::Test manager_pinned_handle_survives_reload()
{
#ifdef _WIN32
Void::Testing::skip("plugin reload is not supported on Windows yet");
#endif
Void::FileSystem::TempDir tmp{"void_mgr"};
const auto so = tmp.path() / "plugin.so";
std::filesystem::copy_file(VOID_STATEFUL_V1_PATH, so);
@@ -212,9 +216,6 @@ Void::Testing::Test manager_legacy_transfer_state_plugin_still_reloads()
// @tag integration
Void::Testing::Test manager_watch_auto_reloads_on_file_change()
{
#ifdef _WIN32
Void::Testing::skip("plugin reload is not supported on Windows yet");
#endif
Void::FileSystem::TempDir tmp{"void_mgr"};
const auto so = tmp.path() / "plugin.so";
std::filesystem::copy_file(VOID_STATEFUL_V1_PATH, so);
@@ -245,9 +246,6 @@ Void::Testing::Test manager_watch_auto_reloads_on_file_change()
Void::Testing::Test manager_multiple_reload_observers_coexist()
{
#ifdef _WIN32
Void::Testing::skip("plugin reload is not supported on Windows yet");
#endif
Void::FileSystem::TempDir tmp{"void_mgr"};
const auto so = tmp.path() / "plugin.so";
std::filesystem::copy_file(VOID_STATEFUL_V1_PATH, so);