feat(toolchain): cross-compile Windows targets with MinGW and run tests under Wine
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 4s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 9s

This commit is contained in:
faumaray committed 2026-12-05 04:47:18 +03:00
1 parent 70483492aa
commit a808596462
8 files changed
+157 -31

No files matched your search

+2
View File
@@ -284,6 +284,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
- **Wave 94 (CPack-Style Self-Extracting Installed & IDE Install Tasks)**: `vbs install --archive FILE --archive-format sh` now emits an executable POSIX self-extracting installer (tar payload + `--prefix`/`PREFIX` handling) in addition to the plain tar; the install test runs the generated script and verifies the extracted prefix. The generated VS Code and Zed tasks gained `vbs: install` and `vbs: package installer` entries (asserted in the IDE test). - **Wave 94 (CPack-Style Self-Extracting Installed & IDE Install Tasks)**: `vbs install --archive FILE --archive-format sh` now emits an executable POSIX self-extracting installer (tar payload + `--prefix`/`PREFIX` handling) in addition to the plain tar; the install test runs the generated script and verifies the extracted prefix. The generated VS Code and Zed tasks gained `vbs: install` and `vbs: package installer` entries (asserted in the IDE test).
- **Wave 96 (Wine-First Windows Target Support)**: `discover_and_probe` selects the MinGW-w64 cross toolchain (`x86_64-w64-mingw32-{g++,gcc,ar}`, or `aarch64` for arm64 targets) when the profile targets Windows from a non-Windows host; Windows targets emit PE artifacts (`<name>.exe`, `<name>.dll`); `vbs build|test` accept `--target-os`/`--target-arch`; `vbs test` runs cross-built Windows test binaries under Wine. Verified end to end: a Windows-target project cross-compiles and its test passes under Wine (`FullV1Tests.track_c_windows_target_cross_build_and_wine_test`, skipped when MinGW/Wine are absent).
## Remaining future scope ## Remaining future scope
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order. - **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
+1
View File
@@ -99,4 +99,5 @@ Base HEAD: `fe0d1a6`
| Wave 93 (Self-contained installers) | `bundle_runtime_dependencies` + deterministic installer archive; `vbs install --bundle-dependencies --archive` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; install CLI test passes with archive extraction and byte-identical reruns, full CTest 8/8) | `include/Void/Build/Install/Installer.hpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs | | Wave 93 (Self-contained installers) | `bundle_runtime_dependencies` + deterministic installer archive; `vbs install --bundle-dependencies --archive` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; install CLI test passes with archive extraction and byte-identical reruns, full CTest 8/8) | `include/Void/Build/Install/Installer.hpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
| Wave 94 (Installer script + IDE install tasks) | `--archive-format sh` self-extracting installer executed in tests; VS Code/Zed install tasks | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; install and IDE tests pass, full CTest 8/8) | `include/Void/Build/Install/Installer.hpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `src/Editor/CompDb.cpp`, `tests/FullV1Tests.cpp`, docs | | Wave 94 (Installer script + IDE install tasks) | `--archive-format sh` self-extracting installer executed in tests; VS Code/Zed install tasks | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; install and IDE tests pass, full CTest 8/8) | `include/Void/Build/Install/Installer.hpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `src/Editor/CompDb.cpp`, `tests/FullV1Tests.cpp`, docs |
| Wave 95 (Superiority plan) | Wrote `22-superiority-and-gaps.md`: gap inventory, revised platforms (macOS deferred; Windows via MinGW-w64 + Wine; native MSVC deferred), CMake/Meson/build2 parity table, differentiators, priority order, acceptance gates; refreshed stale roadmap statuses | PLAN WRITTEN (implementation pending) | `docs/roadmap/22-superiority-and-gaps.md`, `docs/roadmap/{README,20,21}.md`, `STATE.md` | | Wave 95 (Superiority plan) | Wrote `22-superiority-and-gaps.md`: gap inventory, revised platforms (macOS deferred; Windows via MinGW-w64 + Wine; native MSVC deferred), CMake/Meson/build2 parity table, differentiators, priority order, acceptance gates; refreshed stale roadmap statuses | PLAN WRITTEN (implementation pending) | `docs/roadmap/22-superiority-and-gaps.md`, `docs/roadmap/{README,20,21}.md`, `STATE.md` |
| Wave 96 (Wine-first Windows target) | MinGW-w64 cross discovery, PE artifact naming, `--target-os/--target-arch`, Wine test runner | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Windows target cross-build + Wine test pass; full CTest 8/8) | `src/Toolchain/Driver.cpp`, `src/Graph/Graph.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) | | Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
+18
View File
@@ -1351,6 +1351,24 @@ dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color
`vbs: install`. `vbs: install`.
- Full CTest: **8 / 8 passed** in 277.74 s. - Full CTest: **8 / 8 passed** in 277.74 s.
## Wine-First Windows Target Support (GCC 16.2, pin `0002e74`)
Available via `dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc -p wine64`: MinGW-w64 GCC 16.2
(`x86_64-w64-mingw32-*`) and Wine 11.0.
```sh
dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc -p wine64 -c build/pinned/bin/vbs test --project <proj> \
--build-dir <build> --target-os windows --target-arch x86_64 --jobs 4
dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc -p wine64 -c build/pinned/bin/vbs_v1_tests \
--filter track_c_windows_target_cross_build_and_wine_test --no-color
```
- Observed: 4 actions (2 compiles, 2 PE links), `winapp.exe`/`win_test.exe` produced, and
`vbs test: PASSED 'win_test'` through the Wine runner.
- Regression test `FullV1Tests.track_c_windows_target_cross_build_and_wine_test`: **passed**
(8.91 s); it skips when MinGW or Wine is absent.
- Full CTest: **8 / 8 passed** in 279.16 s.
## Limits and Unrun Checks ## Limits and Unrun Checks
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified). 1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
+2
View File
@@ -32,6 +32,8 @@ build2 documentation was **not** available through Context7; build2 statements b
- **Native MSVC / clang-cl host support is deferred** (Track C3-native) until a real Windows - **Native MSVC / clang-cl host support is deferred** (Track C3-native) until a real Windows
host exists. host exists.
Status 2026-12-05: items 1-3 below are **implemented** (`--target-os windows --target-arch x86_64`, MinGW-w64 discovery, `.exe`/`.dll` naming, Wine test runner) and verified by `FullV1Tests.track_c_windows_target_cross_build_and_wine_test`; item 4 (path/case-sensitivity validation under Wine) remains.
Concrete work this implies: Concrete work this implies:
1. Toolchain driver discovers `x86_64-w64-mingw32-{gcc,g++,ar,windres}` and records 1. Toolchain driver discovers `x86_64-w64-mingw32-{gcc,g++,ar,windres}` and records
`target_triple`, PE artifact naming (`.exe`, `.dll`, `.a`/`.lib`, import libraries). `target_triple`, PE artifact naming (`.exe`, `.dll`, `.a`/`.lib`, import libraries).
+10 -4
View File
@@ -8,6 +8,7 @@
#include <Void/Data/StrictJson.hpp> #include <Void/Data/StrictJson.hpp>
#include <Void/System/Path.hpp> #include <Void/System/Path.hpp>
#include <Void/System/Types.hpp> #include <Void/System/Types.hpp>
#include <Void/Text/Str.hpp>
#include <algorithm> #include <algorithm>
#include <format> #include <format>
@@ -488,9 +489,9 @@ expand_glob(const std::filesystem::path &project_root, std::string_view pattern)
if (raw_pattern.is_absolute()) { if (raw_pattern.is_absolute()) {
const auto rel_pattern = raw_pattern.lexically_relative(canonical_root); const auto rel_pattern = raw_pattern.lexically_relative(canonical_root);
if (!rel_pattern.empty() && rel_pattern.native().starts_with("..")) { if (!rel_pattern.empty() && rel_pattern.native().starts_with("..")) {
return std::unexpected{make_error( return std::unexpected{
std::format("expand_glob: pattern '{}' escapes project root '{}'", pattern, make_error(std::format("expand_glob: pattern '{}' escapes project root '{}'",
canonical_root.string()))}; pattern, canonical_root.string()))};
} }
effective_pattern = rel_pattern.lexically_normal().generic_string(); effective_pattern = rel_pattern.lexically_normal().generic_string();
} }
@@ -2024,8 +2025,13 @@ lower_project_graph(const ProjectDescription &description,
graph.actions.push_back(std::move(act)); graph.actions.push_back(std::move(act));
} else if (t.kind == TargetKind::Executable || t.kind == TargetKind::SharedLibrary || } else if (t.kind == TargetKind::Executable || t.kind == TargetKind::SharedLibrary ||
t.kind == TargetKind::Test) { t.kind == TargetKind::Test) {
// Windows targets use PE conventions (.exe executables, .dll shared libraries).
const bool windows_target =
Void::Str::to_lower_ascii(description.profile.os) == "windows";
const auto out_name = const auto out_name =
(t.kind == TargetKind::SharedLibrary) ? ("lib" + t.name + ".so") : t.name; (t.kind == TargetKind::SharedLibrary)
? (windows_target ? (t.name + ".dll") : ("lib" + t.name + ".so"))
: (windows_target ? (t.name + ".exe") : t.name);
const auto bin_path = const auto bin_path =
(t.kind == TargetKind::SharedLibrary ? artifacts_root : (artifacts_root / "bin")) / (t.kind == TargetKind::SharedLibrary ? artifacts_root : (artifacts_root / "bin")) /
out_name; out_name;
+32 -7
View File
@@ -39,13 +39,13 @@
#include <Void/Log/Formatter.hpp> #include <Void/Log/Formatter.hpp>
#include <Void/Log/Log.hpp> #include <Void/Log/Log.hpp>
#include <Void/Log/LoggingAdapter.hpp> #include <Void/Log/LoggingAdapter.hpp>
#include <unistd.h>
#include <Void/System/SignalWatcher.hpp> #include <Void/System/SignalWatcher.hpp>
#include <Void/System/TempDir.hpp> #include <Void/System/TempDir.hpp>
#include <Void/Text/Semver.hpp> #include <Void/Text/Semver.hpp>
#include <Void/Text/Str.hpp> #include <Void/Text/Str.hpp>
#include <Void/Text/Url.hpp> #include <Void/Text/Url.hpp>
#include <Void/Time/Stopwatch.hpp> #include <Void/Time/Stopwatch.hpp>
#include <unistd.h>
#include <algorithm> #include <algorithm>
#include <array> #include <array>
@@ -136,7 +136,8 @@ class ConsoleLogGuard {
} }
logger_ = std::make_unique<Void::Logging::ConsoleLogger>(); logger_ = std::make_unique<Void::Logging::ConsoleLogger>();
if (color_enabled()) { if (color_enabled()) {
auto formatter = std::make_shared<Void::Logging::PatternFormatter>("[{level:,auto}] {message}"); auto formatter =
std::make_shared<Void::Logging::PatternFormatter>("[{level:,auto}] {message}");
formatter->set_color_policy(Void::Logging::ColorPolicy::defaults()); formatter->set_color_policy(Void::Logging::ColorPolicy::defaults());
logger_->set_formatter(std::move(formatter)); logger_->set_formatter(std::move(formatter));
} }
@@ -373,6 +374,8 @@ struct BuildCmdOptions {
std::optional<std::filesystem::path> state_dir; std::optional<std::filesystem::path> state_dir;
std::vector<std::string> trusted_public_keys; std::vector<std::string> trusted_public_keys;
std::vector<std::string> trusted_key_files; std::vector<std::string> trusted_key_files;
std::optional<std::string> target_os_arg;
std::optional<std::string> target_arch_arg;
bool publish_editor_selection{true}; bool publish_editor_selection{true};
bool no_cache{false}; bool no_cache{false};
bool locked{false}; bool locked{false};
@@ -491,13 +494,19 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
return 1; return 1;
} }
const std::string target_os = opts.target_os_arg.value_or(Toolchain::host_os_name());
const std::string target_arch =
opts.target_arch_arg.value_or(Toolchain::host_architecture_name());
const bool windows_cross_target =
Void::Str::to_lower_ascii(target_os) == "windows" &&
Void::Str::to_lower_ascii(Toolchain::host_os_name()) != "windows";
bool all_ok = true; bool all_ok = true;
for (const auto &prof_name : opts.profiles) { for (const auto &prof_name : opts.profiles) {
const auto prof_sw = Void::Time::Stopwatch::started(); const auto prof_sw = Void::Time::Stopwatch::started();
ProfileContext ctx; ProfileContext ctx;
try { try {
ctx = profs->resolve(prof_name, compiler_override, Toolchain::host_os_name(), ctx = profs->resolve(prof_name, compiler_override, target_os, target_arch);
Toolchain::host_architecture_name());
} catch (const std::exception &ex) { } catch (const std::exception &ex) {
std::cerr << "vbs: " << ex.what() << '\n'; std::cerr << "vbs: " << ex.what() << '\n';
return 2; return 2;
@@ -810,7 +819,19 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
Void::Log::info("Test", "[{}] Running test target '{}'...", prof_name, t.name); Void::Log::info("Test", "[{}] Running test target '{}'...", prof_name, t.name);
const auto tsw = Void::Time::Stopwatch::started(); const auto tsw = Void::Time::Stopwatch::started();
Platform::ProcessRequest treq; Platform::ProcessRequest treq;
treq.executable = t.primary_outputs.front(); if (windows_cross_target) {
// Cross-built Windows test binaries execute under Wine (Track C3 Wine-first).
auto wine = Platform::resolve_executable("wine");
if (!wine) {
std::cerr << "vbs test: Windows target tests require 'wine' in PATH\n";
all_ok = false;
continue;
}
treq.executable = *wine;
treq.arguments = {t.primary_outputs.front().string()};
} else {
treq.executable = t.primary_outputs.front();
}
treq.working_directory = project_root; treq.working_directory = project_root;
treq.timeout = std::chrono::seconds{300}; treq.timeout = std::chrono::seconds{300};
auto tres = Platform::run_supervised(treq); auto tres = Platform::run_supervised(treq);
@@ -1703,8 +1724,8 @@ int execute_install_command(const InstallCmdOptions &opts) {
iopts.export_native_metadata = !opts.no_native_export; iopts.export_native_metadata = !opts.no_native_export;
iopts.bundle_runtime_dependencies = opts.bundle_dependencies; iopts.bundle_runtime_dependencies = opts.bundle_dependencies;
if (opts.archive_format_arg != "tar" && opts.archive_format_arg != "sh") { if (opts.archive_format_arg != "tar" && opts.archive_format_arg != "sh") {
std::cerr << "vbs install: unsupported --archive-format '" std::cerr << "vbs install: unsupported --archive-format '" << opts.archive_format_arg
<< opts.archive_format_arg << "' (expected tar or sh)\n"; << "' (expected tar or sh)\n";
return 2; return 2;
} }
if (opts.archive_arg && !opts.archive_arg->empty()) { if (opts.archive_arg && !opts.archive_arg->empty()) {
@@ -2729,6 +2750,10 @@ int main(int argc, char **argv) {
.option_many("--target", "-t", "Target to build/test", build_opts.targets) .option_many("--target", "-t", "Target to build/test", build_opts.targets)
.option("--compiler", "", "Override compiler family (gcc|clang)", .option("--compiler", "", "Override compiler family (gcc|clang)",
build_opts.compiler_arg) build_opts.compiler_arg)
.option("--target-os", "", "Target operating system (default: host, e.g. windows)",
build_opts.target_os_arg)
.option("--target-arch", "", "Target architecture (default: host, e.g. x86_64)",
build_opts.target_arch_arg)
.option("--editor-profile", "", "Editor profile for compile_commands.json", .option("--editor-profile", "", "Editor profile for compile_commands.json",
build_opts.editor_profile) build_opts.editor_profile)
.option_many("--build-source", "", "Additional build description source", .option_many("--build-source", "", "Additional build description source",
+29 -2
View File
@@ -260,12 +260,32 @@ std::string host_architecture_name() {
return "x86_64"; return "x86_64";
} }
namespace {
// Cross toolchain prefix for a non-host target (Track C: Windows via MinGW-w64 under Wine).
std::string cross_compiler_prefix(const ProfileContext &context) {
const std::string target_os = Void::Str::to_lower_ascii(context.os);
if (target_os != "windows" || Void::Str::to_lower_ascii(host_os_name()) == "windows") {
return {};
}
if (context.architecture == "aarch64" || context.architecture == "arm64") {
return "aarch64-w64-mingw32-";
}
return "x86_64-w64-mingw32-";
}
} // namespace
Void::Result::Result<ToolchainCapabilities, Void::Result::Error> Void::Result::Result<ToolchainCapabilities, Void::Result::Error>
discover_and_probe(const ProfileContext &context, discover_and_probe(const ProfileContext &context,
const std::optional<std::filesystem::path> &cache_dir) { const std::optional<std::filesystem::path> &cache_dir) {
const std::string cross_prefix = cross_compiler_prefix(context);
std::filesystem::path requested_compiler; std::filesystem::path requested_compiler;
if (!context.compiler_path.empty()) { if (!context.compiler_path.empty()) {
requested_compiler = context.compiler_path; requested_compiler = context.compiler_path;
} else if (!cross_prefix.empty()) {
requested_compiler =
cross_prefix + (context.compiler == CompilerFamily::Gcc ? "g++" : "clang++");
} else if (context.compiler == CompilerFamily::Gcc) { } else if (context.compiler == CompilerFamily::Gcc) {
requested_compiler = "g++"; requested_compiler = "g++";
} else { } else {
@@ -280,7 +300,11 @@ discover_and_probe(const ProfileContext &context,
} }
std::filesystem::path requested_c_compiler = std::filesystem::path requested_c_compiler =
context.compiler == CompilerFamily::Gcc ? "gcc" : "clang"; !cross_prefix.empty()
? std::filesystem::path{cross_prefix +
(context.compiler == CompilerFamily::Gcc ? "gcc" : "clang")}
: (context.compiler == CompilerFamily::Gcc ? std::filesystem::path{"gcc"}
: std::filesystem::path{"clang"});
if (!context.compiler_path.empty()) { if (!context.compiler_path.empty()) {
const std::filesystem::path cp_path{context.compiler_path}; const std::filesystem::path cp_path{context.compiler_path};
const std::string fname = cp_path.filename().string(); const std::string fname = cp_path.filename().string();
@@ -307,7 +331,10 @@ discover_and_probe(const ProfileContext &context,
} }
std::optional<std::filesystem::path> resolved_ar; std::optional<std::filesystem::path> resolved_ar;
if (context.compiler == CompilerFamily::Clang) { if (!cross_prefix.empty()) {
resolved_ar = Platform::resolve_executable(cross_prefix + "ar");
}
if (!resolved_ar && context.compiler == CompilerFamily::Clang) {
resolved_ar = Platform::resolve_executable("llvm-ar"); resolved_ar = Platform::resolve_executable("llvm-ar");
} }
if (!resolved_ar) { if (!resolved_ar) {
+63 -18
View File
@@ -847,18 +847,12 @@ void build(Void::Build::Project &p) {
Platform::ProcessRequest inst_req; Platform::ProcessRequest inst_req;
inst_req.executable = vbs_bin; inst_req.executable = vbs_bin;
const auto installer_archive = tmp / "cli_hi-installer.tar"; const auto installer_archive = tmp / "cli_hi-installer.tar";
inst_req.arguments = {"install", inst_req.arguments = {"install", "--project",
"--project", cli_proj.string(), "--build-dir",
cli_proj.string(), cli_build.string(), "--prefix",
"--build-dir", cli_prefix.string(), "--package-name",
cli_build.string(), "CliHiPkg", "--bundle-dependencies",
"--prefix", "--archive", installer_archive.string()};
cli_prefix.string(),
"--package-name",
"CliHiPkg",
"--bundle-dependencies",
"--archive",
installer_archive.string()};
auto inst_cli = Platform::run_supervised(inst_req); auto inst_cli = Platform::run_supervised(inst_req);
Void::Testing::expect(inst_cli.has_value() && inst_cli->succeeded()); Void::Testing::expect(inst_cli.has_value() && inst_cli->succeeded());
Void::Testing::expect(std::filesystem::exists(cli_prefix / "bin" / "cli_hi")); Void::Testing::expect(std::filesystem::exists(cli_prefix / "bin" / "cli_hi"));
@@ -887,10 +881,10 @@ void build(Void::Build::Project &p) {
arg = archive_b.string(); arg = archive_b.string();
} }
} }
Void::Testing::expect(Platform::run_supervised(req_a).value_or(Platform::ProcessResult{}) Void::Testing::expect(
.succeeded()); Platform::run_supervised(req_a).value_or(Platform::ProcessResult{}).succeeded());
Void::Testing::expect(Platform::run_supervised(req_b).value_or(Platform::ProcessResult{}) Void::Testing::expect(
.succeeded()); Platform::run_supervised(req_b).value_or(Platform::ProcessResult{}).succeeded());
const auto bytes_a = Void::FileSystem::read_file(archive_a); const auto bytes_a = Void::FileSystem::read_file(archive_a);
const auto bytes_b = Void::FileSystem::read_file(archive_b); const auto bytes_b = Void::FileSystem::read_file(archive_b);
Void::Testing::expect(bytes_a.has_value() && bytes_b.has_value() && *bytes_a == *bytes_b); Void::Testing::expect(bytes_a.has_value() && bytes_b.has_value() && *bytes_a == *bytes_b);
@@ -916,8 +910,8 @@ void build(Void::Build::Project &p) {
auto run_res = Platform::run_supervised(run_script); auto run_res = Platform::run_supervised(run_script);
Void::Testing::expect(run_res.has_value() && run_res->succeeded()); Void::Testing::expect(run_res.has_value() && run_res->succeeded());
Void::Testing::expect(std::filesystem::exists(script_prefix / "bin" / "cli_hi")); Void::Testing::expect(std::filesystem::exists(script_prefix / "bin" / "cli_hi"));
Void::Testing::expect(std::filesystem::exists( Void::Testing::expect(std::filesystem::exists(script_prefix / "share" / "vbs" /
script_prefix / "share" / "vbs" / "CliHiPkg" / "package.json")); "CliHiPkg" / "package.json"));
} }
Platform::ProcessRequest uninst_req; Platform::ProcessRequest uninst_req;
@@ -929,6 +923,57 @@ void build(Void::Build::Project &p) {
} }
} }
// === Track C (Wine-first): cross-compile to Windows with MinGW-w64 and run tests under Wine ===
VOID_TEST(FullV1Tests, track_c_windows_target_cross_build_and_wine_test) {
const auto vbs_bin = locate_vbs_binary();
Void::Testing::expect(!vbs_bin.empty() && std::filesystem::exists(vbs_bin));
if (vbs_bin.empty() || !std::filesystem::exists(vbs_bin)) {
return;
}
// Requires the MinGW-w64 cross toolchain and Wine; skipped in minimal shells.
if (!Platform::resolve_executable("x86_64-w64-mingw32-g++").has_value() ||
!Platform::resolve_executable("wine").has_value()) {
return;
}
Void::FileSystem::TempDir tmp{"vbs_win_"};
const auto proj = tmp / "win_proj";
write_file(proj / "build.cpp", R"cpp(#include <Void/Build.hpp>
void build(Void::Build::Project &p) {
p.executable("winapp").cxx_standard(Void::Build::CxxStandard::Cxx26).sources({"main.cpp"});
p.test("win_test").cxx_standard(Void::Build::CxxStandard::Cxx26).sources({"test.cpp"});
}
)cpp");
write_file(proj / "main.cpp", "#include <cstdio>\nint main() { return 0; }\n");
write_file(proj / "test.cpp", "#include <cstdio>\nint main() { return 0; }\n");
Platform::ProcessRequest req;
req.executable = vbs_bin;
req.arguments = {"test",
"--project",
proj.string(),
"--build-dir",
(tmp / "build").string(),
"--target-os",
"windows",
"--target-arch",
"x86_64",
"--jobs",
"4"};
req.timeout = std::chrono::seconds{600};
auto res = Platform::run_supervised(req);
Void::Testing::expect_eq(
res ? (res->succeeded() ? std::string{} : (res->stdout_data + res->stderr_data))
: res.error().message(),
std::string{});
Void::Testing::expect(res.has_value() && res->succeeded());
if (res) {
Void::Testing::expect(res->stdout_data.find("PASSED 'win_test'") != std::string::npos);
}
Void::Testing::expect(std::filesystem::exists(tmp / "build" / "profiles" / "debug" / "out" /
"bin" / "winapp.exe"));
}
// === Plan 08: Modern C++ (GCC16 P1689 named modules + partitions, cycle/dup checks, unity, PCH) // === Plan 08: Modern C++ (GCC16 P1689 named modules + partitions, cycle/dup checks, unity, PCH)
// === // ===
VOID_TEST(FullV1Tests, modern_cpp_modules_scan_collation_cycles_and_unity_exclusion) { VOID_TEST(FullV1Tests, modern_cpp_modules_scan_collation_cycles_and_unity_exclusion) {