feat(toolchain): cross-compile Windows targets with MinGW and run tests under Wine
This commit is contained in:
1 parent
70483492aa
commit
a808596462
8 files changed
+157
-31
No files matched your search
+63
-18
@@ -847,18 +847,12 @@ void build(Void::Build::Project &p) {
|
||||
Platform::ProcessRequest inst_req;
|
||||
inst_req.executable = vbs_bin;
|
||||
const auto installer_archive = tmp / "cli_hi-installer.tar";
|
||||
inst_req.arguments = {"install",
|
||||
"--project",
|
||||
cli_proj.string(),
|
||||
"--build-dir",
|
||||
cli_build.string(),
|
||||
"--prefix",
|
||||
cli_prefix.string(),
|
||||
"--package-name",
|
||||
"CliHiPkg",
|
||||
"--bundle-dependencies",
|
||||
"--archive",
|
||||
installer_archive.string()};
|
||||
inst_req.arguments = {"install", "--project",
|
||||
cli_proj.string(), "--build-dir",
|
||||
cli_build.string(), "--prefix",
|
||||
cli_prefix.string(), "--package-name",
|
||||
"CliHiPkg", "--bundle-dependencies",
|
||||
"--archive", installer_archive.string()};
|
||||
auto inst_cli = Platform::run_supervised(inst_req);
|
||||
Void::Testing::expect(inst_cli.has_value() && inst_cli->succeeded());
|
||||
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();
|
||||
}
|
||||
}
|
||||
Void::Testing::expect(Platform::run_supervised(req_a).value_or(Platform::ProcessResult{})
|
||||
.succeeded());
|
||||
Void::Testing::expect(Platform::run_supervised(req_b).value_or(Platform::ProcessResult{})
|
||||
.succeeded());
|
||||
Void::Testing::expect(
|
||||
Platform::run_supervised(req_a).value_or(Platform::ProcessResult{}).succeeded());
|
||||
Void::Testing::expect(
|
||||
Platform::run_supervised(req_b).value_or(Platform::ProcessResult{}).succeeded());
|
||||
const auto bytes_a = Void::FileSystem::read_file(archive_a);
|
||||
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);
|
||||
@@ -916,8 +910,8 @@ void build(Void::Build::Project &p) {
|
||||
auto run_res = Platform::run_supervised(run_script);
|
||||
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 / "share" / "vbs" / "CliHiPkg" / "package.json"));
|
||||
Void::Testing::expect(std::filesystem::exists(script_prefix / "share" / "vbs" /
|
||||
"CliHiPkg" / "package.json"));
|
||||
}
|
||||
|
||||
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)
|
||||
// ===
|
||||
VOID_TEST(FullV1Tests, modern_cpp_modules_scan_collation_cycles_and_unity_exclusion) {
|
||||
|
||||
Reference in new issue
Block a user