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
@@ -4,9 +4,32 @@
|
||||
#include <Void/Testing/Fixture.hpp>
|
||||
#include <Void/Testing/Test.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
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
|
||||
|
||||
class ConsoleLoggerTests : public Void::Testing::Fixture
|
||||
{
|
||||
public:
|
||||
@@ -26,14 +49,14 @@ class ConsoleLoggerTests : public Void::Testing::Fixture
|
||||
|
||||
Void::Testing::Test colors_by_default_with_no_color_opt_out()
|
||||
{
|
||||
::unsetenv("NO_COLOR");
|
||||
unset_env("NO_COLOR");
|
||||
{
|
||||
std::ostringstream out;
|
||||
Void::Logging::ConsoleLogger log{out, Void::Logging::Mode::Immediate};
|
||||
log.error("colored");
|
||||
Void::Testing::expect(out.str().find("\x1b[") != std::string::npos);
|
||||
}
|
||||
::setenv("NO_COLOR", "1", 1);
|
||||
set_env("NO_COLOR", "1");
|
||||
{
|
||||
std::ostringstream out;
|
||||
Void::Logging::ConsoleLogger log{out, Void::Logging::Mode::Immediate};
|
||||
@@ -41,7 +64,7 @@ class ConsoleLoggerTests : public Void::Testing::Fixture
|
||||
Void::Testing::expect(out.str().find("\x1b[") == std::string::npos);
|
||||
Void::Testing::expect(out.str().find("plain") != std::string::npos);
|
||||
}
|
||||
::unsetenv("NO_COLOR");
|
||||
unset_env("NO_COLOR");
|
||||
}
|
||||
|
||||
Void::Testing::Test level_filtering()
|
||||
|
||||
Reference in new issue
Block a user