Windows: qualify Configuration, Crypto and System
- Allowlist Configuration, Crypto and System for the Windows target. - System: link winmm for the Win32 audio backend; include windows.h before mmsystem.h. - Tests: add a whole-file // @requires-posix gate (CMake path and the VBS build.cpp) and mark the POSIX-only System suites; skip helper-based cases on Windows; make setenv/unsetenv and getpid portable. - The POSIX process helper is no longer built on Windows. Cross-built with x86_64-w64-mingw32 GCC 16.2: all modules and VoidTests.exe link. Linux System+Testing suite still passes (477 tests, 474 passed). Refs #65
This commit is contained in:
1 parent
c085822686
commit
bd5488b15b
16 files changed
+196
-31
No files matched your search
@@ -7,13 +7,35 @@
|
||||
|
||||
using Void::Configuration::Config;
|
||||
|
||||
namespace
|
||||
{
|
||||
// setenv/unsetenv are POSIX-only; _putenv_s is the Windows equivalent.
|
||||
void set_env(const char* name, const char* value)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_putenv_s(name, value);
|
||||
#else
|
||||
::setenv(name, value, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void unset_env(const char* name)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_putenv_s(name, "");
|
||||
#else
|
||||
::unsetenv(name);
|
||||
#endif
|
||||
}
|
||||
} // namespace
|
||||
|
||||
// ── from_env_prefix ───────────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test env_prefix_strips_and_normalizes()
|
||||
{
|
||||
::setenv("VOIDTEST_LOG__LEVEL", "debug", 1);
|
||||
::setenv("VOIDTEST_PORT", "9000", 1);
|
||||
::setenv("UNRELATED_KEY", "x", 1);
|
||||
set_env("VOIDTEST_LOG__LEVEL", "debug");
|
||||
set_env("VOIDTEST_PORT", "9000");
|
||||
set_env("UNRELATED_KEY", "x");
|
||||
|
||||
const auto cfg = Config::from_env_prefix("VOIDTEST_");
|
||||
Void::Testing::expect(cfg.get_or("log.level") ==
|
||||
@@ -22,9 +44,9 @@ Void::Testing::Test env_prefix_strips_and_normalizes()
|
||||
"9000");
|
||||
Void::Testing::expect(!cfg.contains("unrelated_key"));
|
||||
|
||||
::unsetenv("VOIDTEST_LOG__LEVEL");
|
||||
::unsetenv("VOIDTEST_PORT");
|
||||
::unsetenv("UNRELATED_KEY");
|
||||
unset_env("VOIDTEST_LOG__LEVEL");
|
||||
unset_env("VOIDTEST_PORT");
|
||||
unset_env("UNRELATED_KEY");
|
||||
}
|
||||
|
||||
// ── from_ini_text ─────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user