Merge issue-38-targets follow-up: Windows runtime qualification and MinGW portability
This commit is contained in:
commit
08a40ad5fc
8 files changed
+73
-27
No files matched your search
+5
-5
@@ -37,10 +37,9 @@ set(VOID_WASM_MODULES
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Windows client subset: modules qualified with x86_64-w64-mingw32 (MinGW-w64).
|
# Windows client subset: modules qualified with x86_64-w64-mingw32 (MinGW-w64).
|
||||||
# Filled from the cross-build observations in docs/targets.md; modules that
|
# Filled from the cross-build and Wine runtime observations in
|
||||||
# need POSIX APIs stay out until a Windows implementation is qualified.
|
# docs/targets.md. IO is deliberately absent: it builds on Windows but its
|
||||||
# Observability is excluded: MinGW emits duplicate TLS init functions for its
|
# native backend is Linux-only (EpollBackend), so only the mock backend works.
|
||||||
# inline thread_local hook controls and the link fails.
|
|
||||||
set(VOID_WINDOWS_MODULES
|
set(VOID_WINDOWS_MODULES
|
||||||
Algorithms
|
Algorithms
|
||||||
Async
|
Async
|
||||||
@@ -51,12 +50,13 @@ set(VOID_WINDOWS_MODULES
|
|||||||
Discovery
|
Discovery
|
||||||
Fsm
|
Fsm
|
||||||
Functional
|
Functional
|
||||||
IO
|
|
||||||
Log
|
Log
|
||||||
LogState
|
LogState
|
||||||
Math
|
Math
|
||||||
Memory
|
Memory
|
||||||
Messaging
|
Messaging
|
||||||
|
Observability
|
||||||
|
ObservabilityHooks
|
||||||
Scheduler
|
Scheduler
|
||||||
Service
|
Service
|
||||||
Testing
|
Testing
|
||||||
|
|||||||
+20
-11
@@ -88,7 +88,7 @@ recognized and configured like Linux, but no Alpine build has been observed,
|
|||||||
so musl-specific behaviour (subprocess `/proc`, `dl`, locale) must not be
|
so musl-specific behaviour (subprocess `/proc`, `dl`, locale) must not be
|
||||||
assumed. Record the exact tuple before claiming support.
|
assumed. Record the exact tuple before claiming support.
|
||||||
|
|
||||||
### Windows client (compile/install/consume qualified)
|
### Windows client (compile/install/consume + Wine runtime qualified)
|
||||||
|
|
||||||
| Item | Value |
|
| Item | Value |
|
||||||
|------|-------|
|
|------|-------|
|
||||||
@@ -97,18 +97,27 @@ assumed. Record the exact tuple before claiming support.
|
|||||||
| Standard library | libstdc++ + mingw-w64 CRT (mcfgthread threading in the Nix wrapper) |
|
| Standard library | libstdc++ + mingw-w64 CRT (mcfgthread threading in the Nix wrapper) |
|
||||||
| CMake / generator | CMake 4.5.0, Ninja 1.13.2 |
|
| CMake / generator | CMake 4.5.0, Ninja 1.13.2 |
|
||||||
| Language | C++26, reflection `yes` |
|
| Language | C++26, reflection `yes` |
|
||||||
| Modules | `Algorithms Binary Containers Core Data Functional LogState Math Memory Testing TestingMock Text Time Unicode` plus the compiled subset: `Async Discovery Fsm IO Log Messaging Scheduler Service` |
|
| Runtime | Wine 11.0 (`wine64`), no native Windows runner available |
|
||||||
| Observed | configure, compile, `cmake --install`, and consume (`TargetProfile.exe` linked, not executed on the Linux host) |
|
| Modules | `Algorithms Async Binary Containers Core Data Discovery Fsm Functional Log LogState Math Memory Messaging Observability ObservabilityHooks Scheduler Service Testing TestingMock Text Time Unicode` |
|
||||||
|
| Observed | configure, compile, `cmake --install`, consume (`TargetProfile.exe` linked); `VoidTests.exe` under Wine: **1364 tests, 1360 passed, 4 skipped, 0 failed** |
|
||||||
|
|
||||||
Known blockers for a larger Windows subset:
|
Notes from the runtime run:
|
||||||
|
|
||||||
- `Observability` fails to link with MinGW because the inline `thread_local`
|
- `IO` is **not** in the Windows allowlist. It builds, but its native backend
|
||||||
hook control emits duplicate TLS init functions (GCC/mingw behaviour, not
|
is Linux-only (`EpollBackend`); on Windows `Driver::create` returns
|
||||||
a Void bug). Modules depending on it stay out of the allowlist.
|
`IoErrorCode::unsupported` unless the mock backend is selected. A Windows
|
||||||
- The test suite (`VOID_ENABLE_TESTING=ON`) cross-compiles most suites but
|
IO backend (IOCP) is a separate task.
|
||||||
`tests/standalone/IO/IoFile.cpp` uses POSIX-only `O_CLOEXEC`/`fcntl`, so a
|
- `Observability` links after replacing the namespace-scope
|
||||||
Windows test build currently stops there. Windows runtime tests need a
|
`inline thread_local` hook stack with a function-local `thread_local`
|
||||||
Windows runner.
|
accessor (MinGW emitted duplicate TLS init functions).
|
||||||
|
- Test code is portable: POSIX-only descriptor assertions are guarded, the
|
||||||
|
Log hardening test closes its `ifstream` before removing the file, and the
|
||||||
|
subprocess-isolation test skips when `current_executable_path()` is not
|
||||||
|
implemented (Windows has no subprocess isolation yet).
|
||||||
|
- MinGW test builds need `-Wa,-mbig-obj`: the Fsm hardening test TU exceeds
|
||||||
|
the COFF section limit with the default object format.
|
||||||
|
- Runtime observations come from Wine, not a native Windows runner; a
|
||||||
|
Windows CI runner should confirm them.
|
||||||
|
|
||||||
The Nix MinGW wrapper needs the mcfgthread include/library paths explicitly:
|
The Nix MinGW wrapper needs the mcfgthread include/library paths explicitly:
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,16 @@ struct HookControl {
|
|||||||
std::condition_variable drain_cv;
|
std::condition_variable drain_cv;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline thread_local std::vector<const HookControl*> t_active_hook_controls;
|
// Per-thread stack of hook controls currently executing. A function-local
|
||||||
|
// thread_local keeps a single definition across TUs; a namespace-scope
|
||||||
|
// `inline thread_local` makes MinGW emit one TLS init function per TU and
|
||||||
|
// fails to link with duplicate symbols.
|
||||||
|
[[nodiscard]] inline std::vector<const HookControl*>&
|
||||||
|
active_hook_controls() noexcept
|
||||||
|
{
|
||||||
|
static thread_local std::vector<const HookControl*> controls;
|
||||||
|
return controls;
|
||||||
|
}
|
||||||
|
|
||||||
struct HookCallScope {
|
struct HookCallScope {
|
||||||
const HookControl* control{nullptr};
|
const HookControl* control{nullptr};
|
||||||
@@ -105,14 +114,15 @@ struct HookCallScope {
|
|||||||
explicit HookCallScope(const HookControl* ctrl) : control(ctrl)
|
explicit HookCallScope(const HookControl* ctrl) : control(ctrl)
|
||||||
{
|
{
|
||||||
if (control != nullptr) {
|
if (control != nullptr) {
|
||||||
t_active_hook_controls.push_back(control);
|
active_hook_controls().push_back(control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~HookCallScope() noexcept
|
~HookCallScope() noexcept
|
||||||
{
|
{
|
||||||
if (control != nullptr && !t_active_hook_controls.empty()) {
|
auto& controls = active_hook_controls();
|
||||||
t_active_hook_controls.pop_back();
|
if (control != nullptr && !controls.empty()) {
|
||||||
|
controls.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +131,7 @@ struct HookCallScope {
|
|||||||
|
|
||||||
[[nodiscard]] static bool is_active_on_thread(const HookControl* ctrl) noexcept
|
[[nodiscard]] static bool is_active_on_thread(const HookControl* ctrl) noexcept
|
||||||
{
|
{
|
||||||
for (const auto* entry : t_active_hook_controls) {
|
for (const auto* entry : active_hook_controls()) {
|
||||||
if (entry == ctrl) {
|
if (entry == ctrl) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -315,9 +315,11 @@ Void::Testing::Test io_mock_stop_completion_races_and_clock_timeout()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
Void::Testing::Test io_epoll_socketpair_fragmented_half_close_and_fd_reuse()
|
Void::Testing::Test io_epoll_socketpair_fragmented_half_close_and_fd_reuse()
|
||||||
{
|
{
|
||||||
|
#ifndef __linux__
|
||||||
|
Void::Testing::skip("epoll backend is Linux-only");
|
||||||
|
#else
|
||||||
ManualExecutor exec;
|
ManualExecutor exec;
|
||||||
auto drv_res = Driver::create(
|
auto drv_res = Driver::create(
|
||||||
exec,
|
exec,
|
||||||
@@ -453,10 +455,14 @@ Void::Testing::Test io_epoll_socketpair_fragmented_half_close_and_fd_reuse()
|
|||||||
(reused->first.id().generation > a_orig_id.generation) ||
|
(reused->first.id().generation > a_orig_id.generation) ||
|
||||||
(reused->second.id().generation > a_orig_id.generation);
|
(reused->second.id().generation > a_orig_id.generation);
|
||||||
Void::Testing::expect(bumped);
|
Void::Testing::expect(bumped);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Void::Testing::Test io_epoll_cross_thread_wake_poll_and_stop_tsan()
|
Void::Testing::Test io_epoll_cross_thread_wake_poll_and_stop_tsan()
|
||||||
{
|
{
|
||||||
|
#ifndef __linux__
|
||||||
|
Void::Testing::skip("epoll backend is Linux-only");
|
||||||
|
#else
|
||||||
ManualExecutor exec;
|
ManualExecutor exec;
|
||||||
auto drv_res = Driver::create(exec, BackendOptions{.preference = BackendPreference::epoll});
|
auto drv_res = Driver::create(exec, BackendOptions{.preference = BackendPreference::epoll});
|
||||||
Void::Testing::require(drv_res.has_value());
|
Void::Testing::require(drv_res.has_value());
|
||||||
@@ -505,5 +511,5 @@ Void::Testing::Test io_epoll_cross_thread_wake_poll_and_stop_tsan()
|
|||||||
driver.wake();
|
driver.wake();
|
||||||
poller.join();
|
poller.join();
|
||||||
(void)b.valid();
|
(void)b.valid();
|
||||||
}
|
#endif
|
||||||
#endif // __linux__
|
}
|
||||||
@@ -44,6 +44,20 @@ namespace
|
|||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
// The MinGW CRT has no O_CLOEXEC and no fcntl(F_GETFD); the POSIX-only
|
||||||
|
// descriptor assertions below are guarded separately.
|
||||||
|
int open_readonly(const std::filesystem::path& path)
|
||||||
|
{
|
||||||
|
return ::_wopen(path.c_str(), _O_RDONLY);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
int open_readonly(const std::filesystem::path& path)
|
||||||
|
{
|
||||||
|
return ::open(path.c_str(), O_RDONLY | O_CLOEXEC);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
using Void::Async::ManualExecutor;
|
using Void::Async::ManualExecutor;
|
||||||
using Void::Async::OperationOptions;
|
using Void::Async::OperationOptions;
|
||||||
using Void::Async::TaskScope;
|
using Void::Async::TaskScope;
|
||||||
@@ -535,7 +549,7 @@ Void::Testing::Test io_file_native_roundtrip_isolated_tmpdir()
|
|||||||
expect_eq(drv->telemetry().active_descriptors, std::size_t{0});
|
expect_eq(drv->telemetry().active_descriptors, std::size_t{0});
|
||||||
|
|
||||||
// adopt_file_fd and a default (read-only) open of the same path.
|
// adopt_file_fd and a default (read-only) open of the same path.
|
||||||
auto ro = drv->adopt_file_fd(::open(path.c_str(), O_RDONLY | O_CLOEXEC));
|
auto ro = drv->adopt_file_fd(open_readonly(path));
|
||||||
require(ro.has_value());
|
require(ro.has_value());
|
||||||
File ro_file = std::move(*ro);
|
File ro_file = std::move(*ro);
|
||||||
auto ro2 = drv->open_file(path);
|
auto ro2 = drv->open_file(path);
|
||||||
@@ -1814,10 +1828,12 @@ Void::Testing::Test io_file_counts_against_max_descriptors()
|
|||||||
expect(!std::filesystem::exists(third));
|
expect(!std::filesystem::exists(third));
|
||||||
|
|
||||||
// adopt_file_fd takes ownership only on success.
|
// adopt_file_fd takes ownership only on success.
|
||||||
const int fd = ::open(dir.file("first.bin").c_str(), O_RDONLY | O_CLOEXEC);
|
const int fd = open_readonly(dir.file("first.bin"));
|
||||||
require(fd >= 0);
|
require(fd >= 0);
|
||||||
expect(failed_with(drv->adopt_file_fd(fd), IoErrorCode::overloaded));
|
expect(failed_with(drv->adopt_file_fd(fd), IoErrorCode::overloaded));
|
||||||
|
#if !defined(_WIN32)
|
||||||
expect(::fcntl(fd, F_GETFD) != -1);
|
expect(::fcntl(fd, F_GETFD) != -1);
|
||||||
|
#endif
|
||||||
|
|
||||||
spawn(scope, do_close(&file, {}, &c));
|
spawn(scope, do_close(&file, {}, &c));
|
||||||
(void)exec.drain();
|
(void)exec.drain();
|
||||||
|
|||||||
@@ -368,5 +368,6 @@ Void::Testing::Test log_formatters_multilogger_and_file_sync_reopen()
|
|||||||
std::string content{(std::istreambuf_iterator<char>(ifs)), {}};
|
std::string content{(std::istreambuf_iterator<char>(ifs)), {}};
|
||||||
expect(content.find("before-reopen") != std::string::npos);
|
expect(content.find("before-reopen") != std::string::npos);
|
||||||
expect(content.find("after-reopen") != std::string::npos);
|
expect(content.find("after-reopen") != std::string::npos);
|
||||||
|
ifs.close();
|
||||||
std::filesystem::remove_all(base);
|
std::filesystem::remove_all(base);
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <Void/Testing/Test.hpp>
|
#include <Void/Testing/Test.hpp>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <numbers>
|
||||||
|
|
||||||
static constexpr float EPS = 1e-5f;
|
static constexpr float EPS = 1e-5f;
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ Void::Testing::Test mat4_scale()
|
|||||||
Void::Testing::Test mat4_rotation_z_90_degrees()
|
Void::Testing::Test mat4_rotation_z_90_degrees()
|
||||||
{
|
{
|
||||||
const auto R = Void::Math::Mat4f::rotation_z(
|
const auto R = Void::Math::Mat4f::rotation_z(
|
||||||
static_cast<float>(M_PI) / 2.f);
|
std::numbers::pi_v<float> / 2.f);
|
||||||
const Void::Math::Vec4f v{1, 0, 0, 0};
|
const Void::Math::Vec4f v{1, 0, 0, 0};
|
||||||
const auto r = R * v;
|
const auto r = R * v;
|
||||||
Void::Testing::expect(std::abs(r.x - 0.f) < EPS);
|
Void::Testing::expect(std::abs(r.x - 0.f) < EPS);
|
||||||
|
|||||||
@@ -224,6 +224,9 @@ Void::Testing::Test testing_subprocess_isolation_exit_crash_timeout_and_flood()
|
|||||||
using namespace Void::Testing;
|
using namespace Void::Testing;
|
||||||
|
|
||||||
const std::string exe = current_executable_path();
|
const std::string exe = current_executable_path();
|
||||||
|
if (exe.empty()) {
|
||||||
|
skip("subprocess isolation is not implemented on this platform");
|
||||||
|
}
|
||||||
require(!exe.empty());
|
require(!exe.empty());
|
||||||
|
|
||||||
// 1. Passing self-invocation on skipped/tiny test
|
// 1. Passing self-invocation on skipped/tiny test
|
||||||
|
|||||||
Reference in new issue
Block a user